test: rm flaky retry test (#6431)

This commit is contained in:
Zach Pomerantz 2023-04-24 08:32:38 -07:00 committed by GitHub
parent bc48b4fb0e
commit c36d9c3d3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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)
})
})