test: use delay() helper (#24321)

This commit is contained in:
Milan Burda 2020-06-26 22:59:54 +02:00 committed by GitHub
parent 8eb198bab4
commit 1c49e4e376
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 24 additions and 36 deletions

View file

@ -8,7 +8,7 @@
// python-dbusmock.
import { expect } from 'chai';
import * as dbus from 'dbus-native';
import { ifdescribe } from './spec-helpers';
import { ifdescribe, delay } from './spec-helpers';
import { promisify } from 'util';
describe('powerMonitor', () => {
@ -60,7 +60,7 @@ describe('powerMonitor', () => {
while (retriesRemaining-- > 0) {
calls = await getCalls();
if (calls.length > 0) break;
await new Promise(resolve => setTimeout(resolve, 1000));
await delay(1000);
}
expect(calls).to.be.an('array').that.has.lengthOf(1);
expect(calls[0].slice(1)).to.deep.equal([