mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
87f5df2454
This PR factors out the inline script into an own static method; fixes #4934.
36 lines
970 B
JavaScript
36 lines
970 B
JavaScript
/* global jasmine, describe, beforeAll, afterAll */
|
|
|
|
import { join } from 'path'
|
|
import {
|
|
renderViaHTTP,
|
|
fetchViaHTTP,
|
|
findPort,
|
|
launchApp,
|
|
killApp
|
|
} from 'next-test-utils'
|
|
|
|
// test suits
|
|
import rendering from './rendering'
|
|
import client from './client'
|
|
import csp from './csp'
|
|
|
|
const context = {}
|
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5
|
|
|
|
describe('Document and App', () => {
|
|
beforeAll(async () => {
|
|
context.appPort = await findPort()
|
|
context.server = await launchApp(join(__dirname, '../'), context.appPort)
|
|
|
|
// pre-build all pages at the start
|
|
await Promise.all([
|
|
renderViaHTTP(context.appPort, '/')
|
|
])
|
|
})
|
|
afterAll(() => killApp(context.server))
|
|
|
|
rendering(context, 'Rendering via HTTP', (p, q) => renderViaHTTP(context.appPort, p, q), (p, q) => fetchViaHTTP(context.appPort, p, q))
|
|
client(context, (p, q) => renderViaHTTP(context.appPort, p, q))
|
|
csp(context, (p, q) => renderViaHTTP(context.appPort, p, q))
|
|
})
|