Skip to content

Commit

Permalink
test(client): e2e type checks
Browse files Browse the repository at this point in the history
  • Loading branch information
unnoq committed Dec 19, 2024
1 parent 57a6344 commit 56e31fa
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions packages/client/tests/e2e.test-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { client } from './helpers'

describe('e2e', () => {
it('infer input', () => {
client.user.find({ id: '123' })
// @ts-expect-error - invalid input
client.user.find({ id: 123 })

client.ping()
client.ping('any_thing')

client.nested.countFileSize({} as Blob)
client.nested.countFileSize({} as File)
// @ts-expect-error - invalid input
client.nested.countFileSize({})
})

it('infer output', () => {
expectTypeOf(client.ping()).toEqualTypeOf<Promise<string>>()
expectTypeOf(client.user.find({ id: '123' })).toEqualTypeOf<Promise<{ id: string, name: string }>>()
})

it('works on error', () => {
// @ts-expect-error - invalid input
expect(client.user.find()).rejects.toThrowError(
'Validation input failed',
)
})
})

0 comments on commit 56e31fa

Please sign in to comment.