test(coding-agent): stop the tray ttl case from depending on wall-clock luck
The label derives its ttl text from the clock, so a loaded machine lands a second past the four-minute mark and the exact string flips to `4m 1s`. Assert the ratio and the minute instead; the seconds are the clock's, not the view's.
1473 unmodified linesExpand all14741475147614771478147914781480148114821483148418 unmodified lines1503150415051506150715081505150915101511151215131301 unmodified linesExpand all1473 unmodified linesExpand all }; fakeThis.uiServices = { getContextUsage: () => undefined }; fakeThis.getCurrentModel = () => undefined;
// The ttl text is derived from the clock, so a slow machine can land a second // past the four-minute mark; the ratio and the minute are what matter here. expect(getTrayContextLabel.call(fakeThis)).toBe("50k/75k cached (75%) · ttl 4m"); expect(getTrayContextLabel.call(fakeThis)).toMatch(/^50k\/75k cached \(75%\) · ttl 4m(?: \d+s)?$/); });
test("retains cached ratio and ttl label when agent is streaming", () => { const fakeThis = Object.create(InteractiveMode.prototype) as TrayLabelHarness;18 unmodified lines }; fakeThis.uiServices = { getContextUsage: () => undefined }; fakeThis.getCurrentModel = () => undefined;
// The ttl text is derived from the clock, so a slow machine can land a second // past the four-minute mark; the ratio and the minute are what matter here. expect(getTrayContextLabel.call(fakeThis)).toBe("50k/75k cached (75%) · ttl 4m"); expect(getTrayContextLabel.call(fakeThis)).toMatch(/^50k\/75k cached \(75%\) · ttl 4m(?: \d+s)?$/); });
test("combines active goals, active heartbeats, and context usage in one lower-tray label", () => { const fakeThis = Object.create(InteractiveMode.prototype) as TrayLabelHarness;1301 unmodified linesExpand all