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