2019-04-15 19:10:29 +00:00
|
|
|
const assert = require('assert')
|
|
|
|
|
2019-06-09 01:43:14 +00:00
|
|
|
const { delay } = require('delay')
|
2019-04-15 19:10:29 +00:00
|
|
|
|
|
|
|
describe('delay module', async () => {
|
|
|
|
it('should be a function', () =>{
|
|
|
|
assert.equal(typeof delay, 'function')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should pause a function for specified length in milliseconds', async () => {
|
|
|
|
const delay1 = 1000;
|
|
|
|
const start = +new Date()
|
|
|
|
await delay(delay1)
|
|
|
|
const res1 = +new Date() - start
|
|
|
|
assert.ok(delay1 <= res1)
|
|
|
|
})
|
|
|
|
})
|