Added basic unit test for cache adapter module

- this helps improve our testing capabilities of the new cache adapters
This commit is contained in:
Daniel Lockyer 2023-02-13 17:10:42 +01:00
parent 247d0f1f92
commit 4bca725215
No known key found for this signature in database

View File

@ -0,0 +1,17 @@
const assert = require('assert');
const {getCache} = require('../../../../../core/server/adapters/cache');
const MemoryCache = require('../../../../../core/server/adapters/cache/Memory');
describe('Cache Adapter', function () {
it('defaults to in-memory cache', function () {
const cacheAdapter = getCache('foo');
assert.equal(cacheAdapter instanceof MemoryCache, true);
});
it('returns the same instance for the same name', function () {
const cacheAdapter1 = getCache('foo');
const cacheAdapter2 = getCache('foo');
assert.equal(cacheAdapter1, cacheAdapter2);
});
});