Skip to content

Commit 11042a5

Browse files
committed
test: add fuzzy testing
1 parent f46bdce commit 11042a5

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"devDependencies": {
3131
"@antfu/eslint-config": "^4.10.1",
3232
"@arethetypeswrong/cli": "0.17.4",
33+
"@fast-check/vitest": "^0.1.6",
3334
"@types/fs-extra": "^11.0.4",
3435
"@types/jsdom": "^21.1.7",
3536
"acorn-loose": "^8.4.0",
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { fc, it } from '@fast-check/vitest'
2+
import { renderSSRHead } from '@unhead/ssr'
3+
import { useHead } from '../../src/composables'
4+
import { createHead } from '../../src/server'
5+
6+
fc.configureGlobal({ numRuns: Number.POSITIVE_INFINITY })
7+
8+
describe.runIf(process.env.FUZZY_TEST)('useHead', () => {
9+
it('test', async () => {
10+
const [a, b, c] = ['', '', { '': { toString: '' } }]
11+
const head = createHead()
12+
useHead(head, {
13+
title: b,
14+
link: [a, c],
15+
meta: [{ a, b, c }, c],
16+
style: a,
17+
script: c,
18+
c,
19+
})
20+
await renderSSRHead(head)
21+
})
22+
it.prop([fc.string(), fc.string(), fc.anything()])('breaks', async (a, b, c) => {
23+
const head = createHead()
24+
useHead(head, {
25+
title: b,
26+
link: [a, c],
27+
meta: [{ a, b, c }, c],
28+
style: a,
29+
script: c,
30+
c,
31+
})
32+
await renderSSRHead(head)
33+
})
34+
})

pnpm-lock.yaml

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)