refactor: use findAsyncSequential in a few places (#6377)

* refactor: use findAsyncSequential in a few places

* fixes

* fix
This commit is contained in:
Joshua Chen 2022-01-17 08:57:06 +08:00 committed by GitHub
parent ad16f4fdd9
commit 3cb0972b79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 53 additions and 46 deletions

View file

@ -321,11 +321,11 @@ describe('mapAsyncSequential', () => {
const timeTotal = timeAfter - timeBefore;
const totalTimeouts = sum(Object.values(itemToTimeout));
expect(timeTotal).toBeGreaterThanOrEqual(totalTimeouts);
expect(timeTotal).toBeGreaterThanOrEqual(totalTimeouts - 5);
expect(itemMapStartsAt['1']).toBeGreaterThanOrEqual(0);
expect(itemMapStartsAt['2']).toBeGreaterThanOrEqual(itemMapEndsAt['1']);
expect(itemMapStartsAt['3']).toBeGreaterThanOrEqual(itemMapEndsAt['2']);
expect(itemMapStartsAt['2']).toBeGreaterThanOrEqual(itemMapEndsAt['1'] - 5);
expect(itemMapStartsAt['3']).toBeGreaterThanOrEqual(itemMapEndsAt['2'] - 5);
});
});
@ -353,8 +353,8 @@ describe('findAsyncSequential', () => {
expect(findFn).toHaveBeenNthCalledWith(2, '2');
const timeTotal = timeAfter - timeBefore;
expect(timeTotal).toBeGreaterThanOrEqual(100);
expect(timeTotal).toBeLessThan(150);
expect(timeTotal).toBeGreaterThanOrEqual(95);
expect(timeTotal).toBeLessThan(105);
});
});