Files
kami-parse-server/spec/NullCacheAdapter.spec.js
Florent Vilmart ae1a8226d5 Removes need to use babel-register (#4865)
* Removes need to use babel-register

- Adds watch to watch changes when running the test to regenerate
- Tests are now pure node 8

* Adds timing to helper.js

* Update contribution guide

* Adds inline sourcemaps generation to restore coverage

* nits
2018-07-02 23:30:14 -04:00

38 lines
865 B
JavaScript

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);
});
});