Skip to content

Commit

Permalink
test: add test
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Jan 17, 2025
1 parent eba6941 commit f718f14
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/core/test/jest-expect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,19 @@ describe('async expect', () => {
expect(error).toMatchObject({ message: 'promise rejected "+0" instead of resolving' })
}
})

it('chainable types', async () => {
/* eslint-disable prefer-promise-reject-errors */
await expect(Promise.resolve(1)).resolves.toBeOneOf([1])
await expect(Promise.resolve(1)).resolves.not.toBeOneOf([2])
await expect(Promise.reject(1)).rejects.toBeOneOf([1])
await expect(Promise.reject(1)).rejects.not.toBeOneOf([2])
await expect(Promise.resolve(1)).resolves.toSatisfy(v => v === 1)
await expect(Promise.reject(2)).rejects.toSatisfy(v => v === 2)
await (expect(Promise.resolve(1)).resolves.to.equal(1) satisfies Promise<any>)
await (expect(Promise.resolve(1)).resolves.not.to.equal(2) satisfies Promise<any>)
/* eslint-enable prefer-promise-reject-errors */
})
})

it('compatible with jest', () => {
Expand Down

0 comments on commit f718f14

Please sign in to comment.