Skip to content

Commit 72e38f9

Browse files
committed
tests: ensure quota labels are not displayed
Add assertions to tests to verify formatted output no longer contains the literal labels "Quota (remaining)" or "Quota (used)". Updated tests/format.test.ts and tests/tui-sidebar-format.test.ts to include these negative checks and refactored one sidebar test to capture lines before asserting content. This enforces that quota formatting omits verbose label text.
1 parent 6e01bd3 commit 72e38f9

2 files changed

Lines changed: 19 additions & 9 deletions

File tree

tests/format.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ describe("formatQuotaRows", () => {
2222

2323
expect(out).toContain("Copilot");
2424
expect(out).toContain("75% left");
25+
expect(out).not.toContain("Quota (remaining)");
26+
expect(out).not.toContain("Quota (used)");
2527
});
2628

2729
it("uses tiny layout when maxWidth is small", () => {
@@ -60,6 +62,8 @@ describe("formatQuotaRows", () => {
6062
const barLine = lines[1] ?? "";
6163
expect(barLine).toContain("19% used");
6264
expect(barLine).not.toContain("81% left");
65+
expect(out).not.toContain("Quota (remaining)");
66+
expect(out).not.toContain("Quota (used)");
6367
expect((barLine.match(//g) ?? [])).toHaveLength(2);
6468
});
6569

@@ -167,6 +171,8 @@ describe("formatQuotaRows", () => {
167171
.find((line) => line.includes("%"));
168172
expect(barLine).toContain("19% used");
169173
expect(barLine).not.toContain("81% left");
174+
expect(out).not.toContain("Quota (remaining)");
175+
expect(out).not.toContain("Quota (used)");
170176
expect((barLine?.match(//g) ?? [])).toHaveLength(2);
171177
});
172178

tests/tui-sidebar-format.test.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,17 @@ describe("buildSidebarQuotaPanelLines", () => {
8080
sessionTokens: data.sessionTokens,
8181
}).split("\n");
8282

83-
expect(
84-
buildSidebarQuotaPanelLines({
85-
data,
86-
config: {
87-
formatStyle: "classic",
88-
percentDisplayMode: "remaining",
89-
},
90-
}),
91-
).toEqual(expected);
83+
const lines = buildSidebarQuotaPanelLines({
84+
data,
85+
config: {
86+
formatStyle: "classic",
87+
percentDisplayMode: "remaining",
88+
},
89+
});
90+
91+
expect(lines).toEqual(expected);
92+
expect(lines.join("\n")).not.toContain("Quota (remaining)");
93+
expect(lines.join("\n")).not.toContain("Quota (used)");
9294
});
9395

9496
it("renders grouped sidebar output via the shared grouped formatter", () => {
@@ -185,6 +187,8 @@ describe("buildSidebarQuotaPanelLines", () => {
185187
const barLine = lines[1] ?? "";
186188
expect(barLine).toContain("19% used");
187189
expect(barLine).not.toContain("81% left");
190+
expect(lines.join("\n")).not.toContain("Quota (remaining)");
191+
expect(lines.join("\n")).not.toContain("Quota (used)");
188192
expect((barLine.match(//g) ?? [])).toHaveLength(5);
189193
});
190194

0 commit comments

Comments
 (0)