diff --git a/src/lib/cache.test.ts b/src/lib/cache.test.ts index 0ac37bff96..a4ec8e4e40 100644 --- a/src/lib/cache.test.ts +++ b/src/lib/cache.test.ts @@ -36,10 +36,11 @@ describe("cached (memory-only, no Redis)", () => { 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); + const ttl = 20; + expect(await cached(key, ttl, fn)).toBe(1); + expect(await cached(key, ttl, fn)).toBe(1); + await new Promise((r) => setTimeout(r, 40)); + expect(await cached(key, ttl, fn)).toBe(2); expect(fn).toHaveBeenCalledTimes(2); });