test.govlab/patterns/core/factories/graph.factory.test.ts
test.govlab/patterns/core/factories/graph.factory.test.ts is a file in Codebase Testing. 12 lines of code and 0 definitions.
import { describe, expect, it } from "vitest";
import { GraphError } from "@govlab/patterns/core/validators/graph.validator.ts";
import { graphOf } from "@govlab/patterns/core/factories/graph.factory.ts";
import { sourceNode } from "@govlab/patterns/core/factories/node.factory.ts";
describe("graphOf", () => {
it("returns a validated graph over the nodes", () => {
expect(graphOf([sourceNode()]).nodes).toHaveLength(1);
});
it("refuses an invalid node set before returning", () => {
expect(() => graphOf([sourceNode(), sourceNode()])).toThrow(GraphError);
});
});