test: rm flaky retry test (#6431)
This commit is contained in:
parent
bc48b4fb0e
commit
c36d9c3d3f
@ -41,26 +41,4 @@ describe('retry', () => {
|
||||
setTimeout(cancel, 0)
|
||||
await expect(promise).resolves.toEqual('abc')
|
||||
})
|
||||
|
||||
async function checkTime(fn: () => Promise<any>, min: number, max: number) {
|
||||
const time = new Date().getTime()
|
||||
await fn()
|
||||
const diff = new Date().getTime() - time
|
||||
expect(diff).toBeGreaterThanOrEqual(min)
|
||||
expect(diff).toBeLessThanOrEqual(max)
|
||||
}
|
||||
|
||||
it('waits random amount of time between min and max', async () => {
|
||||
const promises = []
|
||||
for (let i = 0; i < 10; i++) {
|
||||
promises.push(
|
||||
checkTime(
|
||||
() => expect(retry(makeFn(4, 'abc'), { n: 3, maxWait: 100, minWait: 50 }).promise).rejects.toThrow('failure'),
|
||||
150,
|
||||
400
|
||||
)
|
||||
)
|
||||
}
|
||||
await Promise.all(promises)
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user