smarttime/test/test.timer.both.ts

27 lines
597 B
TypeScript
Raw Normal View History

2018-03-11 16:44:32 +01:00
// tslint:disable-next-line:no-implicit-dependencies
2023-07-12 11:28:52 +02:00
import { expect, tap } from '@push.rocks/tapbundle';
2018-03-11 16:44:32 +01:00
2022-11-21 09:14:32 +01:00
import { Timer } from '../ts/index.js';
2018-03-11 16:44:32 +01:00
let testTimer: Timer;
tap.test('should create a valid timer', async () => {
testTimer = new Timer(1000);
2022-02-02 16:55:12 +01:00
expect(testTimer).toBeInstanceOf(Timer);
2018-06-10 14:00:18 +02:00
});
2018-03-11 16:44:32 +01:00
tap.test('should start timer', async () => {
2018-06-10 14:00:18 +02:00
testTimer.start();
2018-03-11 16:44:32 +01:00
await testTimer.completed;
2018-06-10 14:00:18 +02:00
});
2018-03-11 16:44:32 +01:00
2018-11-23 18:48:07 +01:00
tap.test('should reset a timer', async () => {
testTimer.reset();
testTimer.start();
testTimer.reset();
testTimer.start();
await testTimer.completed;
});
export default tap.start();