early/test/test.ts

26 lines
660 B
TypeScript
Raw Normal View History

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';
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 () => {
await early.stop();
});
2017-04-23 16:46:13 +00:00
tap.test('hrTime Measurement', async () => {
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);
});
2017-04-23 16:46:13 +00:00
tap.start();