-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Expand file tree
/
Copy pathNullCacheAdapter.spec.js
More file actions
32 lines (27 loc) · 836 Bytes
/
Copy pathNullCacheAdapter.spec.js
File metadata and controls
32 lines (27 loc) · 836 Bytes
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
const NullCacheAdapter = require('../lib/Adapters/Cache/NullCacheAdapter').default;
describe('NullCacheAdapter', function () {
const KEY = 'hello';
const VALUE = 'world';
it('should expose promisifyed methods', done => {
const cache = new NullCacheAdapter({
ttl: NaN,
});
// Verify all methods return promises.
Promise.all([cache.put(KEY, VALUE), cache.del(KEY), cache.get(KEY), cache.clear()]).then(() => {
done();
});
});
it('should get/set/clear', done => {
const cache = new NullCacheAdapter({
ttl: NaN,
});
cache
.put(KEY, VALUE)
.then(() => cache.get(KEY))
.then(value => expect(value).toEqual(null))
.then(() => cache.clear())
.then(() => cache.get(KEY))
.then(value => expect(value).toEqual(null))
.then(done);
});
});