-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAdapter.deleteMultiple.test.ts
49 lines (44 loc) · 1.35 KB
/
Adapter.deleteMultiple.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import type { CacheInterface } from '@soluble/cache-interop';
import { Guards } from '@soluble/cache-interop';
import { getTestAdapters } from '../setup/getTestAdapters';
const adapters = getTestAdapters();
describe.each(adapters)('Adapter: %s', (name, adapterFactory) => {
let cache: CacheInterface;
beforeAll(async () => {
cache = await adapterFactory();
});
afterEach(async () => {
await cache.clear();
});
afterAll(async () => {
if (Guards.isConnectedCache(cache)) {
await cache.getConnection().quit();
}
});
describe('Adapter.deleteMultiple()', () => {
it('should return a Map with key and boolean', async () => {
await cache.set('key-exists', 'cool');
const resp = await cache.deleteMultiple(['key-exists', 'no1']);
expect(resp).toStrictEqual<any>(
new Map([
['key-exists', true],
['no1', false],
])
);
});
describe('when disableCache is set to true', () => {
it('should return a Map with key and false', async () => {
await cache.set('key-exists', 'cool');
const resp = await cache.deleteMultiple(['key-exists', 'no1'], {
disableCache: true,
});
expect(resp).toStrictEqual<any>(
new Map([
['key-exists', false],
['no1', false],
])
);
});
});
});
});