2026-02-15 22:57:28 +00:00
|
|
|
import { expect, tap } from '@git.zone/tstest/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;
|
|
|
|
|
});
|
|
|
|
|
|
2024-06-23 23:27:10 +02:00
|
|
|
export default tap.start();
|