+12
-11
@@ -424,11 +424,12 @@ test("sidebar text places reset timing beside latest remaining quota", () => {
|
||||
label: null,
|
||||
used: 25,
|
||||
remaining: 75,
|
||||
sessionConsumed: 1.5,
|
||||
resetsAt: 100_000 + 2 * 86_400_000 + 5 * 3_600_000,
|
||||
},
|
||||
100_000,
|
||||
),
|
||||
).toBe("7d: 75% left · resets in 2d 5h");
|
||||
).toBe("75% · ~1.5pp · 2d 5h");
|
||||
});
|
||||
|
||||
test("sidebar reset timing uses compact future units and handles boundaries", () => {
|
||||
@@ -441,31 +442,31 @@ test("sidebar reset timing uses compact future units and handles boundaries", ()
|
||||
label: null,
|
||||
used: 25,
|
||||
remaining: 75,
|
||||
sessionConsumed: 1.5,
|
||||
resetsAt: now + resetIn,
|
||||
},
|
||||
now,
|
||||
);
|
||||
|
||||
expect(format(2 * 3_600_000 + 15 * 60_000)).toBe("5h: 75% left · resets in 2h 15m");
|
||||
expect(format(3_600_000)).toBe("5h: 75% left · resets in 1h");
|
||||
expect(format(15 * 60_000)).toBe("5h: 75% left · resets in 15m");
|
||||
expect(format(60_000)).toBe("5h: 75% left · resets in 1m");
|
||||
expect(format(59_999)).toBe("5h: 75% left · resets in <1m");
|
||||
expect(format(2 * 3_600_000 + 15 * 60_000)).toBe("75% · ~1.5pp · 2h 15m");
|
||||
expect(format(3_600_000)).toBe("75% · ~1.5pp · 1h");
|
||||
expect(format(15 * 60_000)).toBe("75% · ~1.5pp · 15m");
|
||||
expect(format(60_000)).toBe("75% · ~1.5pp · 1m");
|
||||
expect(format(59_999)).toBe("75% · ~1.5pp · <1m");
|
||||
});
|
||||
|
||||
test("sidebar reset timing distinguishes stale and unavailable timestamps", () => {
|
||||
test("sidebar reset timing omits labels and distinguishes stale and unavailable timestamps", () => {
|
||||
const window = {
|
||||
seconds: 18_000,
|
||||
id: "codex:primary",
|
||||
label: "GPT-5.6 Luna",
|
||||
used: 99.95,
|
||||
remaining: 0.05,
|
||||
sessionConsumed: 1.5,
|
||||
};
|
||||
expect(formatQuotaWindow({ ...window, resetsAt: 999 }, 1_000)).toBe(
|
||||
"GPT-5.6 Luna 5h: <0.1% left · reset due",
|
||||
);
|
||||
expect(formatQuotaWindow({ ...window, resetsAt: 999 }, 1_000)).toBe("<0.1% · ~1.5pp · due");
|
||||
expect(formatQuotaWindow({ ...window, resetsAt: Number.NaN }, 1_000)).toBe(
|
||||
"GPT-5.6 Luna 5h: <0.1% left · reset unavailable",
|
||||
"<0.1% · ~1.5pp · unavailable",
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
+1
-1
@@ -84,7 +84,7 @@ test("built quota slot stays reactive across pending, empty, failure, update, an
|
||||
|
||||
pending.resolve(status("plus", 75));
|
||||
await setup.waitForFrame((frame) => frame.includes("ChatGPT quota (plus)"));
|
||||
expect(setup.captureCharFrame()).toContain("5h: 75% left · reset due");
|
||||
expect(setup.captureCharFrame()).toContain("75% · ~1.5pp · due");
|
||||
|
||||
responses.push(async () => null);
|
||||
notifyUpdated();
|
||||
|
||||
Reference in New Issue
Block a user