early/test/test.ts
2023-08-22 20:37:45 +02:00

26 lines
660 B
TypeScript

import { expect, expectAsync, tap } from '@push.rocks/tapbundle';
import * as smartdelay from '@push.rocks/smartdelay';
import * as early from '../ts/index.js';
tap.test('.start()', async () => {
process.env.CLI_CALL_MODULENAME = 'early';
early.start('early');
await smartdelay.delayFor(2000);
});
tap.test('.stop()', async () => {
await early.stop();
});
tap.test('hrTime Measurement', async () => {
let earlyHr = new early.HrtMeasurement();
earlyHr.start();
await smartdelay.delayFor(1000);
let measuredTime = earlyHr.stop();
console.log(measuredTime);
return expect(measuredTime.milliSeconds).toBeGreaterThan(999);
});
tap.start();