Skip to content

Commit

Permalink
test: update async tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed May 17, 2024
1 parent 9c89781 commit c258231
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,10 +434,12 @@ test('async', async () => {

expect(spy.called).toBe(true)
expect(spy.results[0][1]).toBeInstanceOf(Promise)
expect(spy.results[0][1]).toBe(promise)

const count = await promise

expect(spy.results).toEqual([['ok', 1]])
expect(spy.results[0][0]).toBe('ok')
expect(spy.results[0][1]).toBe(promise)
expect(count).toBe(1)
})

Expand All @@ -461,8 +463,8 @@ test('async error', async () => {
caughtError = e
}

expect(spy.results[0][0]).toEqual('error')
expect(spy.results[0][1].message).toEqual('async error')
expect(spy.results[0][0]).toEqual('ok')
expect(spy.results[0][1]).toBe(promise)
expect(caughtError).toBeInstanceOf(Error)
expect(caughtError?.message).toEqual('async error')
})
Expand Down

0 comments on commit c258231

Please sign in to comment.