A games launcher for GOG, Amazon and Epic Games for Linux, Windows and macOS.
TypeScript amazon-primeelectronepic-games-launcherepic-games-storeepic-storegaminggoggog-galaxyheroic-games-launcherlinuxplay-gamesprotonsteamwine
import { withTimeout } from '../with_timeout'
describe('withTimeout', () => {
it('returns the value when the promise is fast enough', async () => {
await expect(
withTimeout(Promise.resolve('done'), 100, 'fallback')
).resolves.toBe('done')
})
it('returns the fallback when the promise takes too long', async () => {
await expect(
withTimeout(new Promise(() => undefined), 20, 'fallback')
).resolves.toBe('fallback')
})
it('returns the fallback when the promise rejects', async () => {
await expect(
withTimeout(Promise.reject(new Error('nope')), 100, 'fallback')
).resolves.toBe('fallback')
})
})