@unito/integration-sdk
Version:
Integration SDK
22 lines (17 loc) • 677 B
text/typescript
import assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import { LocalCache } from 'cachette';
import { Cache } from '../../src/resources/cache.js';
describe('Cache', () => {
describe('initializeCache', () => {
it('no redis url returns Cache with a inner LocalCache', async () => {
const cache = Cache.create();
assert.ok(cache instanceof Cache);
assert.ok(cache['cacheInstance'] instanceof LocalCache);
await cache['cacheInstance'].quit();
});
it('redis url tries to return a RedisCache', () => {
assert.throws(() => Cache.create('fakeredis'), Error, 'Invalid redis url fakereis.');
});
});
});