Skip to content

Commit

Permalink
increase the sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredwray committed Feb 11, 2025
1 parent 770b188 commit 361050b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/cache-manager/test/wrap.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ describe('wrap', () => {

expect(await cache.wrap(data.key, async () => ++value, getTtlFunction, config.refreshThreshold)).toEqual(11); // 1st call should be cached
expect(getTtlFunction).toHaveBeenNthCalledWith(1, 11); // Ttl func called 1st time when cache empty
await sleep(1001);
await sleep(1500);
expect(await cache.wrap(data.key, async () => ++value, getTtlFunction, config.refreshThreshold)).toEqual(11); // Trigger background refresh. stale value returned
expect(getTtlFunction).toHaveBeenNthCalledWith(2, 12); // Ttl func called 2nd time triggered by refreshThreshold on fresh item
});
Expand Down

0 comments on commit 361050b

Please sign in to comment.