feat(cms): improve catalog, editorial recovery and operations
CI / check (push) Successful in 52s
CI / deploy (push) Successful in 2m10s
CI / publish-container (push) Failing after 1m18s

This commit is contained in:
Simo committed 2026-09-09 19:36:15 +02:00
1 parent 2fead134e6
commit c389c3893d
122 files changed
+8137 -703

No files matched your search

@@ -0,0 +1,53 @@
import { describe, expect, it } from "vitest";
import { getDashboardEventPhase } from "./dashboard-event-phase";
const now = new Date("2026-09-09T12:00:00Z");
const event = (
startsAt: string,
endsAt: string | null = null,
status = "published",
) => ({
startsAt: new Date(startsAt),
endsAt: endsAt ? new Date(endsAt) : null,
status,
});
describe("dashboard event timing", () => {
it("shows a future published event without requiring an end", () => {
expect(getDashboardEventPhase(event("2026-09-09T13:00:00Z"), now)).toBe(
"upcoming",
);
});
it("marks the start boundary and known duration as ongoing", () => {
expect(
getDashboardEventPhase(
event("2026-09-09T12:00:00Z", "2026-09-09T13:00:00Z"),
now,
),
).toBe("ongoing");
});
it("excludes ended events including the exact end boundary", () => {
expect(
getDashboardEventPhase(
event("2026-09-09T11:00:00Z", "2026-09-09T12:00:00Z"),
now,
),
).toBeNull();
});
it("does not invent a duration for old events without an end", () => {
expect(
getDashboardEventPhase(event("2026-09-08T12:00:00Z"), now),
).toBeNull();
});
it.each(["draft", "cancelled", "completed"])(
"excludes %s events",
(status) => {
expect(
getDashboardEventPhase(
event("2026-09-09T13:00:00Z", null, status),
now,
),
).toBeNull();
},
);
});