deno.land / x / rambda@v9.1.1 / source / wait.spec.js

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { wait } from './wait.js'
test('happy path', async () => { const fn = x => Promise.resolve(x + 1) const [ result, err ] = await wait(fn(1))
expect(result).toBe(2) expect(err).toBeUndefined()})
test('when promise is rejected', async () => { const fn = x => Promise.reject(Error('foo')) const [ result, err ] = await wait(fn(1))
expect(result).toBeUndefined() expect(err).toEqual(Error('foo'))})
rambda

Version Info

Tagged at
2 months ago