2017-03-26 20:01:33 +00:00
|
|
|
import { expect, tap } from 'tapbundle'
|
|
|
|
import * as smartdelay from 'smartdelay'
|
2016-09-15 12:59:22 +00:00
|
|
|
import early = require('../dist/index')
|
2016-05-20 17:06:25 +00:00
|
|
|
|
2017-03-26 20:01:33 +00:00
|
|
|
tap.test('.start()', async () => {
|
|
|
|
early.start('early')
|
|
|
|
await smartdelay.delayFor(2000)
|
2016-09-15 12:59:22 +00:00
|
|
|
})
|
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 () => {
|
2017-04-23 18:57:01 +00:00
|
|
|
let earlyHr = new early.HrtMeasurement()
|
2017-04-23 16:46:13 +00:00
|
|
|
earlyHr.start()
|
|
|
|
await smartdelay.delayFor(1000)
|
|
|
|
let measuredTime = earlyHr.stop()
|
|
|
|
console.log(measuredTime)
|
|
|
|
return expect(measuredTime.milliSeconds).to.be.greaterThan(999)
|
|
|
|
})
|
|
|
|
|
|
|
|
tap.start()
|