Skip to content

Commit

Permalink
Update wrap.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredwray committed Dec 11, 2024
1 parent d7f8db2 commit 46b8d47
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/cache-manager/test/wrap.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ describe('wrap with multi-layer stores', () => {
expect(await keyv2.get(data.key)).toEqual(0);

// Sleep 501ms, trigger keyv1 refresh
await sleep(501);
await sleep(550);

// Background refresh, but stale value returned, while keyv1 and keyv2 are all updated
expect(await cache.wrap(data.key, async () => 1)).toEqual(0);
Expand All @@ -173,7 +173,7 @@ describe('wrap with multi-layer stores', () => {
expect(await keyv2.get(data.key)).toEqual(1);

// Sleep 1001ms, keyv1 expired, but keyv2 was refreshed before, so keyv2 will not be refreshed, write back to keyv1 directly
await sleep(1001);
await sleep(1050);

expect(await keyv1.get(data.key)).toBeUndefined();
expect(await keyv2.get(data.key)).toEqual(1);
Expand All @@ -183,8 +183,8 @@ describe('wrap with multi-layer stores', () => {
expect(await keyv1.get(data.key)).toEqual(1);
expect(await keyv2.get(data.key)).toEqual(1);

// Sleep 801ms, keyv1 expired, trigger keyv2 refresh
await sleep(801);
// Sleep 850ms, keyv1 expired, trigger keyv2 refresh
await sleep(850);

expect(await keyv1.get(data.key)).toBeUndefined();
expect(await keyv2.get(data.key)).toEqual(1);
Expand Down

0 comments on commit 46b8d47

Please sign in to comment.