Files
community-rule/tests/unit/lastPublishedRule.test.ts
T
adilallo d9c475a967 Give finished Rules a print path, folded launch counts, and a two-day follow-up.
Export is PDF, RULE.md, and Print on US Letter, with every shared term, no member names, and a takeaway that points at Ask an organizer. Finished Rules keep type and place so the team can read folded counts without a database, Umami can sit beside the app with no cookies, and the person who holds the pen gets working PDF and RULE.md links 48 hours later.
2026-11-10 18:32:33 -07:00

20 lines
639 B
TypeScript

import { describe, expect, it } from "vitest";
import { finishedAtIso } from "../../lib/create/lastPublishedRule";
describe("finishedAtIso", () => {
it("normalizes strings and dates", () => {
expect(finishedAtIso("2026-11-08T12:00:00.000Z")).toBe(
"2026-11-08T12:00:00.000Z",
);
expect(finishedAtIso(new Date("2026-11-08T12:00:00.000Z"))).toBe(
"2026-11-08T12:00:00.000Z",
);
});
it("returns undefined for empty or invalid values", () => {
expect(finishedAtIso("")).toBeUndefined();
expect(finishedAtIso("not-a-date")).toBeUndefined();
expect(finishedAtIso(null)).toBeUndefined();
});
});