BREAKING CHANGE(core): switch to esm
This commit is contained in:
12
test/test.ts
12
test/test.ts
@ -1,6 +1,6 @@
|
||||
import { expect, tap } from '@pushrocks/tapbundle';
|
||||
import * as levelcache from '../ts/index';
|
||||
import { CacheEntry } from '../ts/index';
|
||||
import * as levelcache from '../ts/index.js';
|
||||
import { CacheEntry } from '../ts/index.js';
|
||||
|
||||
let testLevelCache: levelcache.LevelCache;
|
||||
|
||||
@ -8,7 +8,7 @@ tap.test('should create a new levelcache instance', async () => {
|
||||
testLevelCache = new levelcache.LevelCache({
|
||||
cacheId: 'myCache',
|
||||
});
|
||||
expect(testLevelCache).to.be.instanceOf(levelcache.LevelCache);
|
||||
expect(testLevelCache).toBeInstanceOf(levelcache.LevelCache);
|
||||
});
|
||||
|
||||
tap.test('should cache a value', async () => {
|
||||
@ -21,7 +21,7 @@ tap.test('should cache a value', async () => {
|
||||
})
|
||||
);
|
||||
const result = await testLevelCache.retrieveCacheEntryByKey('mykey');
|
||||
expect(result.contents.toString()).to.equal('heythere');
|
||||
expect(result.contents.toString()).toEqual('heythere');
|
||||
});
|
||||
|
||||
tap.test('should respect ttl', async (tools) => {
|
||||
@ -34,10 +34,10 @@ tap.test('should respect ttl', async (tools) => {
|
||||
})
|
||||
);
|
||||
const result = await testLevelCache.retrieveCacheEntryByKey('mykey');
|
||||
expect(result.contents.toString()).to.equal('heythere');
|
||||
expect(result.contents.toString()).toEqual('heythere');
|
||||
await tools.delayFor(1100);
|
||||
const result2 = await testLevelCache.retrieveCacheEntryByKey('mykey');
|
||||
expect(result2).to.be.null;
|
||||
expect(result2).toBeNull();
|
||||
});
|
||||
|
||||
tap.start();
|
||||
|
Reference in New Issue
Block a user