2020-03-30 23:09:36 +00:00
|
|
|
import { expect } from 'chai';
|
|
|
|
|
2020-03-31 13:29:47 +00:00
|
|
|
import { defer, timeout } from '../../src/Async';
|
|
|
|
import { TimeoutError } from '../../src/error/TimeoutError';
|
2020-03-30 23:09:36 +00:00
|
|
|
import { describeLeaks, itLeaks } from '../helpers/async';
|
|
|
|
|
|
|
|
describeLeaks('async utils', async () => {
|
|
|
|
describeLeaks('defer', async () => {
|
|
|
|
itLeaks('should resolve', async () => expect(defer(10, true)).to.eventually.equal(true));
|
|
|
|
});
|
|
|
|
|
|
|
|
describeLeaks('timeout', async () => {
|
|
|
|
itLeaks('should reject slow promises', async () => expect(timeout(10, defer(20))).to.eventually.be.rejectedWith(TimeoutError));
|
|
|
|
});
|
|
|
|
});
|