1
0
Fork 0
js-utils/test/utils/TestAsync.ts

15 lines
485 B
TypeScript
Raw Normal View History

import { expect } from 'chai';
import { defer, timeout } from '../../src/Async';
import { TimeoutError } from '../../src/error/TimeoutError';
describe('async utils', async () => {
describe('defer', async () => {
it('should resolve', async () => expect(defer(10, true)).to.eventually.equal(true));
});
describe('timeout', async () => {
it('should reject slow promises', async () => expect(timeout(10, defer(20))).to.eventually.be.rejectedWith(TimeoutError));
});
});