2023-08-22 18:37:45 +00:00
|
|
|
import { expect, expectAsync, tap } from '@push.rocks/tapbundle';
|
|
|
|
import * as smartdelay from '@push.rocks/smartdelay';
|
2022-03-21 07:30:09 +00:00
|
|
|
|
2022-03-21 17:21:07 +00:00
|
|
|
import * as early from '../ts/index.js';
|
2016-05-20 17:06:25 +00:00
|
|
|
|
2017-03-26 20:01:33 +00:00
|
|
|
tap.test('.start()', async () => {
|
2022-03-21 07:30:09 +00:00
|
|
|
process.env.CLI_CALL_MODULENAME = 'early';
|
2018-07-17 21:12:12 +00:00
|
|
|
early.start('early');
|
|
|
|
await smartdelay.delayFor(2000);
|
|
|
|
});
|
2017-04-23 16:46:13 +00:00
|
|
|
|
2017-03-26 20:01:33 +00:00
|
|
|
tap.test('.stop()', async () => {
|
2018-07-17 21:12:12 +00:00
|
|
|
await early.stop();
|
|
|
|
});
|
2017-04-23 16:46:13 +00:00
|
|
|
|
|
|
|
tap.test('hrTime Measurement', async () => {
|
2018-07-17 21:12:12 +00:00
|
|
|
let earlyHr = new early.HrtMeasurement();
|
|
|
|
earlyHr.start();
|
|
|
|
await smartdelay.delayFor(1000);
|
|
|
|
let measuredTime = earlyHr.stop();
|
|
|
|
console.log(measuredTime);
|
2022-03-21 07:30:09 +00:00
|
|
|
return expect(measuredTime.milliSeconds).toBeGreaterThan(999);
|
2018-07-17 21:12:12 +00:00
|
|
|
});
|
2017-04-23 16:46:13 +00:00
|
|
|
|
2018-07-17 21:12:12 +00:00
|
|
|
tap.start();
|