Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

test(frontend): stop the clock test walking 90 days of resync ticks (#21848)

Danny Xu7fb6ced561b3
diff --git a/frontend/src/hooks/useTimeReading.test.tsx b/frontend/src/hooks/useTimeReading.test.tsx
index b34c83178c..b996afbef8 100644
--- a/frontend/src/hooks/useTimeReading.test.tsx
+++ b/frontend/src/hooks/useTimeReading.test.tsx
@@ -113,9 +113,11 @@ describe("useTimeReading", () => {
});
test("waits quietly for a deadline beyond the platform timer ceiling", () => {
- // setTimeout holds its delay in 32 bits; anything past ~24.8 days fires at
- // once. A date waiting for the year to turn is ordinary input.
- const deadlineMs = Date.now() + 90 * DAY_MS;
+ // setTimeout holds its delay in 32 bits, so anything past ~24.8 days fires
+ // at once. The clock walks to a deadline one resync interval at a time, so
+ // this sits a day past that ceiling rather than further out.
+ const timerCeilingMs = 2 ** 31 - 1;
+ const deadlineMs = Date.now() + timerCeilingMs + DAY_MS;
const { renders } = mount([{ changesAtMs: () => deadlineMs }]);
const setTimeoutSpy = vi.spyOn(globalThis, "setTimeout");
@@ -126,7 +128,7 @@ describe("useTimeReading", () => {
expect(renders).toEqual([1]);
act(() => {
- vi.advanceTimersByTime(90 * DAY_MS);
+ vi.advanceTimersByTime(timerCeilingMs + DAY_MS);
});
expect(renders).toEqual([2]);
});