fume-fhir-converter
Version:
FHIR-Utilized Mapping Engine - Community
38 lines (32 loc) • 906 B
text/typescript
/**
* © Copyright Outburn Ltd. 2022-2024 All Rights Reserved
* Project name: FUME-COMMUNITY
*/
import { test } from '@jest/globals';
import { getCache, initCache } from './cache';
import { SimpleCache } from './simpleCache';
class TestCache extends SimpleCache<any> {}
describe('SimpleCache', () => {
test('getCache fails if not init', async () => {
expect(() => {
getCache();
}).toThrow();
});
test('initCache with default class', async () => {
initCache();
expect(() => {
getCache();
}).not.toThrow();
});
test('initCache with override class', async () => {
initCache({
aliases: {
cacheClass: TestCache,
cacheClassOptions: {}
}
});
const { aliases, mappings } = getCache();
expect(aliases).toBeInstanceOf(TestCache);
expect(mappings).toBeInstanceOf(SimpleCache);
});
});