Skip to content

Commit

Permalink
Refactor test
Browse files Browse the repository at this point in the history
  • Loading branch information
maxima-net committed Aug 24, 2022
1 parent b733d78 commit f438d38
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions tests/core/cache/cache.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,20 @@ describe('InMemoryCache', () => {

test('clears all entries', () => {
cache = new InMemoryCache({ absoluteExpirationMs: 1000 * 60 * 5 });
const key1 = 'key1';
const value1 = 'value1';
const key2 = 'key2';
const value2 = 'value2';
const entries: Array<[key: string, value: string]> = [
['key1', 'value1'],
['key2', 'value2']
];

cache.set(key1, value1);
cache.set(key2, value2);
entries.forEach(([key, value]) => {
cache.set(key, value);
});

cache.clear();

const removedValue1 = cache.get(key1);
expect(removedValue1).toBeUndefined();
const removedValue2 = cache.get(key2);
expect(removedValue2).toBeUndefined();
entries.forEach(([key]) => {
const removedValue = cache.get(key);
expect(removedValue).toBeUndefined();
});
});
});

0 comments on commit f438d38

Please sign in to comment.