forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhttps-server.generated-key.test.ts
More file actions
45 lines (39 loc) · 1.42 KB
/
https-server.generated-key.test.ts
File metadata and controls
45 lines (39 loc) · 1.42 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { nextTestSetup } from 'e2e-utils'
import https from 'https'
import { renderViaHTTP, shouldRunTurboDevTest } from 'next-test-utils'
describe('experimental-https-server (generated certificate)', () => {
const { next, skipped } = nextTestSetup({
files: __dirname,
startCommand: `pnpm next ${
shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'
} --experimental-https`,
skipStart: !process.env.CI,
})
if (skipped) return
if (!process.env.CI) {
console.warn('only runs on CI as it requires administrator privileges')
it('only runs on CI as it requires administrator privileges', () => {})
return
}
const agent = new https.Agent({
rejectUnauthorized: false,
})
it('should successfully load the app in app dir', async () => {
expect(next.url).toInclude('https://')
const html = await renderViaHTTP(next.url, '/1', undefined, { agent })
expect(html).toContain('Hello from App')
})
it('should successfully load the app in pages dir', async () => {
expect(next.url).toInclude('https://')
const html = await renderViaHTTP(next.url, '/2', undefined, { agent })
expect(html).toContain('Hello from Pages')
})
it('should successfully reuse generated certificates', async () => {
await next.stop()
await next.start()
expect(next.url).toInclude('https://')
expect(next.cliOutput).toContain(
'Using already generated self signed certificate'
)
})
})