Skip to content

Commit 10d30e6

Browse files
authored
fixing multi-cache testing of ttl wrap function (#636)
* fixing multi-cache testing of ttl wrap function * updating sleep
1 parent 2f6d831 commit 10d30e6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

test/caching.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ describe('caching', () => {
241241
await expect(cache.wrap(key, async () => 'foo')).resolves.toEqual(value);
242242

243243
expect(fn).toHaveBeenCalledTimes(1);
244-
await sleep(2000);
244+
await sleep(3000);
245245
await expect(cache.get(key)).resolves.toBeUndefined();
246246
});
247247

test/multi-caching.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ describe('multiCaching', () => {
111111
// eslint-disable-next-line @typescript-eslint/no-unused-vars
112112
const sec = faker.number.int({ min: 2, max: 4 });
113113
value = faker.string.sample(sec * 2);
114-
const fn = vi.fn((v: string) => (v.length / 2) * 1000);
114+
const fn = vi.fn((v: string) => 1000);
115115
await multiCache.wrap(key, async () => value, fn);
116116
await expect(memoryCache.get(key)).resolves.toEqual(value);
117117
await expect(memoryCache2.get(key)).resolves.toEqual(value);
@@ -120,7 +120,7 @@ describe('multiCaching', () => {
120120
value,
121121
);
122122
expect(fn).toHaveBeenCalledTimes(1);
123-
await sleep(sec * 1000);
123+
await sleep(3000);
124124
await expect(memoryCache.get(key)).resolves.toBeUndefined();
125125
await expect(memoryCache2.get(key)).resolves.toBeUndefined();
126126
await expect(memoryCache3.get(key)).resolves.toBeUndefined();

0 commit comments

Comments
 (0)