The open-source app everyone uses to manage agents at work
TypeScript acpxagent-orchestrationagent-skillsagentic-aiai-agentsai-engineeringai-governanceai-toolsautonomous-agentsclaudeclaude-codeclaude-skillscodexhermesllmmcpmulti-agentopenclawproject-managementworkflow-automation
test(ui): make the suite pass outside UTC (#11480)
Tonioadd65ba4a293
diff --git a/ui/src/pages/StatusCards/format.test.ts b/ui/src/pages/StatusCards/format.test.tsindex 5a39b0a925..d44f58e3e4 100644--- a/ui/src/pages/StatusCards/format.test.ts+++ b/ui/src/pages/StatusCards/format.test.ts@@ -30,11 +30,19 @@ function update(overrides: Partial<StatusCardUpdate>): StatusCardUpdate {};}+// A fixed instant rather than the real clock. `rollupUpdatesToday` filters on+// the *UTC* day boundary, so a suite that builds its fixtures from `new Date()`+// fails in two ways: it straddles midnight UTC if the run happens to cross it,+// and in any zone east of UTC+12 "today at local noon" is already yesterday in+// UTC, so the rows it means to count are filtered out. The function takes `now`+// for exactly this reason — the sibling test below already passes one.+const NOW = new Date("2026-07-23T12:00:00.000Z");+function iso(daysAgo: number): string {- const d = new Date();- d.setDate(d.getDate() - daysAgo);- // Noon avoids DST/midnight edge cases in the local-day filter.- d.setHours(12, 0, 0, 0);+ const d = new Date(NOW);+ d.setUTCDate(d.getUTCDate() - daysAgo);+ // Noon UTC, so a row is unambiguously inside the UTC day it belongs to.+ d.setUTCHours(12, 0, 0, 0);return d.toISOString();}@@ -61,7 +69,7 @@ describe("rollupUpdatesToday", () => {// yesterday + last week — must not be counted as "today"update({ kind: "full", inputTokens: 9999, outputTokens: 9999, costCents: 99, startedAt: iso(1) }),update({ kind: "incremental", inputTokens: 9999, outputTokens: 9999, costCents: 99, startedAt: iso(7) }),- ]);+ ], NOW);// Only today's full rebuild counts as an update (compile excluded).expect(rollup.updateCount).toBe(1);// Today's tokens/cost include today's compile but not older days.diff --git a/ui/vitest.config.ts b/ui/vitest.config.tsindex 8ffcafbe9e..2ae4a757cb 100644--- a/ui/vitest.config.ts+++ b/ui/vitest.config.ts@@ -11,5 +11,14 @@ export default defineConfig({test: {environment: "node",setupFiles: ["./vitest.setup.ts"],+ // Pin the clock's timezone so date rendering is the same everywhere.+ //+ // Several suites supply a UTC instant and assert on the local-time string+ // the UI renders from it — "2026-07-17T16:08:00.000Z" is expected to read+ // "Today, 4:08 PM". That only holds where local time is UTC. CI passes+ // because GitHub's runners happen to default to UTC; a contributor in any+ // other zone sees those tests fail on a clean checkout, which reads as+ // "the suite is broken" rather than "your clock differs".+ env: { TZ: "UTC" },},});