Files
PacketStation/frontend/src/lib/voidStamp.test.ts
T

23 lines
854 B
TypeScript
Raw Normal View History

import { describe, expect, it } from "vitest";
import { voidText } from "./voidStamp";
describe("voidText", () => {
it("names the CO, the new sheet and the date", () => {
const at = new Date(2026, 9, 16, 12).toISOString();
expect(voidText({ void: { co_id: 9, co_no: 2, at, new_n: 1001, new: { n: 1001, dwg: "CI-DWG-1", rev: "B" } } })).toBe(
"VOID - superseded by CO-2 (CI-DWG-1 Rev B) 10/16/2026",
);
});
it("finds the new sheet in the pages when the read model gives only new_n", () => {
const at = new Date(2026, 0, 5, 12).toISOString();
expect(voidText({ void: { co_id: 9, co_no: 3, at, new_n: 4 } }, [{ n: 4, dwg: null, rev: null }])).toBe(
"VOID - superseded by CO-3 (new sheet Rev ?) 1/5/2026",
);
});
it("is empty for a live page", () => {
expect(voidText({ void: null })).toBe("");
});
});