Files
lik/test/test.fastmap.both.ts

28 lines
686 B
TypeScript
Raw Normal View History

2021-09-12 16:08:20 +02:00
import { tap, expect } from '@pushrocks/tapbundle';
2022-05-27 17:53:02 +02:00
import * as lik from '../ts/index.js';
2021-09-12 16:08:20 +02:00
tap.test('should create a valid fastmap', async () => {
const fastmap = new lik.FastMap();
2022-01-24 05:22:49 +01:00
expect(fastmap).toBeInstanceOf(lik.FastMap);
2021-09-12 16:08:20 +02:00
});
tap.test('should find an entry', async () => {
const fastmap = new lik.FastMap<{
value1: string;
value2: string;
}>();
fastmap.addToMap('heythere', {
value1: 'heyho',
value2: 'heyho2'
})
fastmap.addToMap('heythere2', {
value1: 'heyho3',
value2: 'heyho4'
});
const result = await fastmap.find(async (itemArg)=> {return itemArg.value2 === 'heyho4'});
2022-01-24 05:22:49 +01:00
expect(result.value1).toEqual('heyho3');
2021-09-12 16:08:20 +02:00
});
tap.start();