mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[Promise.race/tests] make completion time an inclusive range (#10605)
Backports PR #10511
**Commit 1:**
[Promise.race/tests] make completion time an inclusive range
* Original sha: c077a06f63
* Authored by spalger <spalger@users.noreply.github.com> on 2017-02-22T17:19:40Z
This commit is contained in:
parent
eda064af67
commit
34d1e9ff5a
1 changed files with 2 additions and 2 deletions
|
@ -110,8 +110,8 @@ describe('Promise service', function () {
|
||||||
const p2 = new Promise(resolve => setTimeout(resolve, 5000));
|
const p2 = new Promise(resolve => setTimeout(resolve, 5000));
|
||||||
await Promise.race([p1, p2]);
|
await Promise.race([p1, p2]);
|
||||||
const time = Date.now() - start;
|
const time = Date.now() - start;
|
||||||
expect(time).to.be.lessThan(1000);
|
expect(time).to.not.be.lessThan(100);
|
||||||
expect(time).to.be.greaterThan(100);
|
expect(time).to.not.be.greaterThan(2000);
|
||||||
});
|
});
|
||||||
it('allows non-promises in the array', async () => {
|
it('allows non-promises in the array', async () => {
|
||||||
expect(await Promise.race([1,2,3])).to.be(1);
|
expect(await Promise.race([1,2,3])).to.be(1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue