SPB Git

Repository Public

logic.test.ts 822 B 17 lines typescript

1import { describe, expect, it } from "vitest";2import { actionDurationSeconds, tabFromParam } from "./logic";34describe("activity logic", () => {5  it("falls back to the feed tab", () => {6    expect(tabFromParam("actions")).toBe("actions");7    expect(tabFromParam("approvals")).toBe("approvals");8    expect(tabFromParam(null)).toBe("feed");9    expect(tabFromParam("x")).toBe("feed");10  });11  it("computes a duration only when both ends are known and ordered", () => {12    expect(actionDurationSeconds({ started_at: "2026-11-18T10:00:00Z", finished_at: "2026-11-18T10:00:12Z" })).toBe(12);13    expect(actionDurationSeconds({ started_at: "2026-11-18T10:00:00Z" })).toBeUndefined();14    expect(actionDurationSeconds({ started_at: "2026-11-18T10:00:12Z", finished_at: "2026-11-18T10:00:00Z" })).toBeUndefined();15  });16});17
Files main
Menu

Theme