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

Commit

Permalink
test: add some very basic type tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Oct 12, 2022
1 parent 53db611 commit b21a8ce
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/fixtures/basic/types.ts
Expand Up @@ -120,6 +120,34 @@ describe('runtimeConfig', () => {
})
})

describe('head', () => {
it('correctly types nuxt.config options', () => {
// @ts-expect-error
defineNuxtConfig({ app: { head: { titleTemplate: () => 'test' } } })
defineNuxtConfig({
app: {
head: {
meta: [{ key: 'key', name: 'description', content: 'some description ' }],
titleTemplate: 'test %s'
}
}
})
})
it('types useHead', () => {
useHead({
base: { href: '/base' },
link: computed(() => []),
meta: [
{ key: 'key', name: 'description', content: 'some description ' },
() => ({ key: 'key', name: 'description', content: 'some description ' })
],
titleTemplate: (titleChunk) => {
return titleChunk ? `${titleChunk} - Site Title` : 'Site Title'
}
})
})
})

describe('composables', () => {
it('allows providing default refs', () => {
expectTypeOf(useState('test', () => ref('hello'))).toEqualTypeOf<Ref<string>>()
Expand Down

0 comments on commit b21a8ce

Please sign in to comment.