mirror of
https://github.com/Nystik-gh/ignis.git
synced 2026-06-17 04:35:53 +00:00
expand shim coverage, additional fs shims, add light stream shim
This commit is contained in:
30
packages/shim/src/node/assert.test.js
Normal file
30
packages/shim/src/node/assert.test.js
Normal file
@@ -0,0 +1,30 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { assertShim as assert } from "./assert.js";
|
||||
|
||||
describe("assert shim", () => {
|
||||
it("is callable and throws on a falsy value", () => {
|
||||
expect(() => assert(false)).toThrow();
|
||||
expect(() => assert(true)).not.toThrow();
|
||||
});
|
||||
|
||||
it("equal throws on mismatch and passes on loose match", () => {
|
||||
expect(() => assert.equal(1, 2)).toThrow();
|
||||
expect(() => assert.equal(1, 1)).not.toThrow();
|
||||
expect(() => assert.equal(1, "1")).not.toThrow();
|
||||
});
|
||||
|
||||
it("strictEqual distinguishes type", () => {
|
||||
expect(() => assert.strictEqual(1, "1")).toThrow();
|
||||
expect(() => assert.strictEqual(1, 1)).not.toThrow();
|
||||
});
|
||||
|
||||
it("throws() verifies that a function threw", () => {
|
||||
expect(() =>
|
||||
assert.throws(() => {
|
||||
throw new Error("x");
|
||||
}),
|
||||
).not.toThrow();
|
||||
|
||||
expect(() => assert.throws(() => {})).toThrow();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user