fix(ci): stabilize post-cutover checks
CI / check (pull_request) Successful in 35s
CI / release (pull_request) Skipped
CI / deploy (pull_request) Skipped

This commit is contained in:
Simo committed 2026-08-30 21:13:07 +02:00
1 parent 6ae0aef6c0
commit cdfae0b967
2 files changed
+27 -21

No files matched your search

+14 -8
View File
@@ -33,14 +33,20 @@ describe("cached (memory-only, no Redis)", () => {
});
it("recomputes after the TTL expires", async () => {
let count = 0;
const fn = vi.fn(async () => ++count);
const key = `ttl-${Math.random()}`;
expect(await cached(key, 1, fn)).toBe(1);
expect(await cached(key, 1, fn)).toBe(1);
await new Promise((r) => setTimeout(r, 10));
expect(await cached(key, 1, fn)).toBe(2);
expect(fn).toHaveBeenCalledTimes(2);
vi.useFakeTimers();
try {
vi.setSystemTime(1_000);
let count = 0;
const fn = vi.fn(async () => ++count);
const key = `ttl-${Math.random()}`;
expect(await cached(key, 100, fn)).toBe(1);
expect(await cached(key, 100, fn)).toBe(1);
vi.advanceTimersByTime(100);
expect(await cached(key, 100, fn)).toBe(2);
expect(fn).toHaveBeenCalledTimes(2);
} finally {
vi.useRealTimers();
}
});
it("invalidates a key so the next read recomputes", async () => {