forked from nuxt/test-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic.test.ts
More file actions
26 lines (21 loc) · 917 Bytes
/
basic.test.ts
File metadata and controls
26 lines (21 loc) · 917 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { fileURLToPath } from 'node:url'
import { describe, expect, it } from 'vitest'
import { $fetch, setup, startServer } from '@nuxt/test-utils/e2e'
describe('ssr', async () => {
await setup({
rootDir: fileURLToPath(new URL('./fixtures/basic', import.meta.url)),
})
it('renders the index page', async () => {
// Get response to a server-rendered page with `$fetch`.
const html = await $fetch('/')
expect(html).toContain('<div>basic <span>original value</span></div>')
})
it('changes runtime config and restarts', async () => {
await startServer({ env: { NUXT_PUBLIC_MY_VALUE: 'overwritten by test!' } })
const html = await $fetch('/')
expect(html).toContain('<div>basic <span>overwritten by test!</span></div>')
await startServer()
const htmlRestored = await $fetch('/')
expect(htmlRestored).toContain('<div>basic <span>original value</span></div>')
})
})