Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
test: update type test assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Sep 12, 2022
1 parent ffc227c commit 711a417
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/fixtures/basic/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { describe, it } from 'vitest'
import type { Ref } from 'vue'
import type { AppConfig } from '@nuxt/schema'

import type { FetchError } from 'ohmyfetch'
import { NavigationFailure, RouteLocationNormalizedLoaded, RouteLocationRaw, useRouter as vueUseRouter } from 'vue-router'
import { defineNuxtConfig } from '~~/../../../packages/nuxt/src'
import type { NavigateToOptions } from '~~/../../../packages/nuxt/dist/app/composables/router'
Expand Down Expand Up @@ -47,7 +48,7 @@ describe('API routes', () => {
expectTypeOf(useFetch('/api/other').data).toEqualTypeOf<Ref<unknown>>()
expectTypeOf(useFetch<TestResponse>('/test').data).toEqualTypeOf<Ref<TestResponse>>()

expectTypeOf(useFetch('/error').error).toEqualTypeOf<Ref<Error | null | true>>()
expectTypeOf(useFetch('/error').error).toEqualTypeOf<Ref<FetchError | null | true>>()
expectTypeOf(useFetch<any, string>('/error').error).toEqualTypeOf<Ref<string | null | true>>()

expectTypeOf(useLazyFetch('/api/hello').data).toEqualTypeOf<Ref<string>>()
Expand All @@ -57,7 +58,7 @@ describe('API routes', () => {
expectTypeOf(useLazyFetch('/api/other').data).toEqualTypeOf<Ref<unknown>>()
expectTypeOf(useLazyFetch<TestResponse>('/test').data).toEqualTypeOf<Ref<TestResponse>>()

expectTypeOf(useLazyFetch('/error').error).toEqualTypeOf<Ref<Error | null | true>>()
expectTypeOf(useLazyFetch('/error').error).toEqualTypeOf<Ref<FetchError | null | true>>()
expectTypeOf(useLazyFetch<any, string>('/error').error).toEqualTypeOf<Ref<string | null | true>>()
})
})
Expand Down

0 comments on commit 711a417

Please sign in to comment.