load
This commit is contained in:
13
src/lib/invariant.test.ts
Normal file
13
src/lib/invariant.test.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { invariant } from "./invariant";
|
||||
|
||||
describe("invariant", () => {
|
||||
it.each([0, "", null, undefined, 0n])("should throw for %p", (value) => {
|
||||
expect(() => invariant(value)).toThrowError("Invariant failed: ");
|
||||
expect(() => invariant(value, "some message")).toThrowError("Invariant failed: some message");
|
||||
});
|
||||
|
||||
it.each([true, 1, "some str", {}, [], 123n])("should not throw for %p", (value) => {
|
||||
expect(() => invariant(value)).not.toThrowError();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user