дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-06 01:57:13 +02:00
Mocha runs showed no test tree, and single tests ran with Jest's `-t`. A `package.json` script that runs `mocha` is now a test configuration with `testRunner: "mocha"`. Test runs import the IDE's hook (`mochaHook.js`, a `data:` URL in `NODE_OPTIONS`), which prints a record per finished test (file, suite chain, status, duration, declaration line, error) next to the run's own reporter; the records become the tree and are hidden from the console. Gutter icons, Rerun Failed Tests and running selected tests use Mocha's own `--grep`. New fixture `fixtures/mocha-app`, run by `smoke/run.test.ts` in the TypeScript job. Closes #5153 Co-authored-by: wildcatDownstairs <[email protected]>
30 рядки
802 B
JavaScript
30 рядки
802 B
JavaScript
import assert from "node:assert/strict";
|
|
import { bulkDiscount, withTax } from "../src/pricing.js";
|
|
|
|
describe("pricing", function () {
|
|
describe("withTax", function () {
|
|
it("adds the rate", function () {
|
|
assert.equal(withTax(100, 0.2), 120);
|
|
});
|
|
|
|
it("rejects a negative rate", function () {
|
|
assert.throws(() => withTax(100, -0.1), RangeError);
|
|
});
|
|
});
|
|
|
|
describe("bulkDiscount", function () {
|
|
it("has no discount for a few items", function () {
|
|
assert.equal(bulkDiscount(3), 0);
|
|
});
|
|
|
|
it("discounts large orders", function () {
|
|
assert.equal(bulkDiscount(250), 0.15);
|
|
});
|
|
});
|
|
|
|
it("intentionally fails (set OPENIDEA_FAIL=1)", function () {
|
|
if (!process.env.OPENIDEA_FAIL) this.skip();
|
|
assert.equal(withTax(10, 0.1), 11.5);
|
|
});
|
|
});
|