Skip to content

Commit

Permalink
test: add type test (#933)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored Nov 16, 2023
1 parent 598e4be commit 9c2673b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ jobs:
- name: 🛠 Build project
run: pnpm build

- name: 💪 Test built types
run: pnpm test:types

- name: 🧪 Test project
run: pnpm test -- --coverage

Expand Down
10 changes: 10 additions & 0 deletions test/types/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/// <reference types="../../playground/.nuxt/nuxt.d.ts" />

import { describe, expectTypeOf, it } from 'vitest'

describe('useSanityQuery', () => {
it('should return typed response', () => {
const response = useSanityQuery<{ title: string }>(`*[_type == "article"]{title}`)
expectTypeOf(response.data).toEqualTypeOf<Ref<{ title: string } | null>>()
})
})

0 comments on commit 9c2673b

Please sign in to comment.