it("re-arms the timer when onTimer is called while state.running is true", async () => { const timeoutSpy = vi.spyOn(globalThis, "setTimeout"); const store = await makeStorePath(); const now = Date.parse("2026-02-06T10:05:00.000Z");
// Before the fix in #12025, this would return without re-arming, // silently killing the scheduler.
await onTimer(state);
// The timer must be re-armed so the scheduler continues ticking, // with a fixed 60s delay to avoid hot-looping.
expect(state.timer).not.toBeNull();
expect(timeoutSpy).toHaveBeenCalled(); const delays = timeoutSpy.mock.calls
.map(([, delay]) => delay)
.filter((d): d is number => typeof d === "number");
expect(delays).toContain(60_000);
// state.running should still be true (onTimer bailed out, didn't // touch it — the original caller's finally block handles that).
expect(state.running).toBe(true);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.