Skip to content

Commit 1e8c9b0

Browse files
committed
test: cover dashboard formatters
(cherry picked from commit 2173066)
1 parent 31ab94a commit 1e8c9b0

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

test/dashboard-formatters.test.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { describe, expect, it } from "vitest";
2+
import {
3+
formatDashboardSettingState,
4+
formatMenuLayoutMode,
5+
formatMenuQuotaTtl,
6+
formatMenuSortMode,
7+
} from "../lib/codex-manager/dashboard-formatters.js";
8+
9+
describe("dashboard-formatters", () => {
10+
it("formats dashboard toggle states", () => {
11+
expect(formatDashboardSettingState(true)).toBe("[x]");
12+
expect(formatDashboardSettingState(false)).toBe("[ ]");
13+
});
14+
15+
it("formats sort mode labels", () => {
16+
expect(formatMenuSortMode("ready-first")).toBe("Ready-First");
17+
expect(formatMenuSortMode("manual")).toBe("Manual");
18+
});
19+
20+
it("formats layout mode labels", () => {
21+
expect(formatMenuLayoutMode("expanded-rows")).toBe("Expanded Rows");
22+
expect(formatMenuLayoutMode("compact-details")).toBe(
23+
"Compact + Details Pane",
24+
);
25+
});
26+
27+
it("formats quota ttl values across minute, second, and millisecond branches", () => {
28+
expect(formatMenuQuotaTtl(120_000)).toBe("2m");
29+
expect(formatMenuQuotaTtl(5_000)).toBe("5s");
30+
expect(formatMenuQuotaTtl(500)).toBe("500ms");
31+
expect(formatMenuQuotaTtl(1_500)).toBe("1500ms");
32+
});
33+
});

0 commit comments

Comments
 (0)