lik/test/test.looptracker.both.ts

25 lines
726 B
TypeScript
Raw Normal View History

2017-07-05 12:29:08 +00:00
// import test framework
2018-07-15 14:04:27 +00:00
import { expect, tap } from '@pushrocks/tapbundle';
2017-07-05 12:29:08 +00:00
// import the module
2022-05-27 15:53:02 +00:00
import * as lik from '../ts/index.js';
2017-07-05 12:29:08 +00:00
2018-07-15 14:04:27 +00:00
let object1 = {};
let object2 = {};
let myLoopTracker: lik.LoopTracker<any>;
2017-07-05 12:29:08 +00:00
// tests
tap.test('should create a valid looptracker instance', async () => {
2018-07-15 14:04:27 +00:00
myLoopTracker = new lik.LoopTracker();
2022-01-24 04:22:49 +00:00
expect(myLoopTracker).toBeInstanceOf(lik.LoopTracker);
2018-07-15 14:04:27 +00:00
});
2017-07-05 12:37:26 +00:00
tap.test('should add objects once and return true', async () => {
2022-01-24 04:22:49 +00:00
expect(myLoopTracker.checkAndTrack(object1)).toBeTrue();
expect(myLoopTracker.checkAndTrack(object1)).toBeFalse();
expect(myLoopTracker.checkAndTrack(object2)).toBeTrue();
expect(myLoopTracker.checkAndTrack(object2)).toBeFalse();
2018-07-15 14:04:27 +00:00
});
2017-07-05 12:37:26 +00:00
2023-11-09 20:17:13 +00:00
await tap.start();