1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
next.js/test/integration/app-document/test/index.test.js
ǝlzlǝoq lǝᴉuɐp ツ 87f5df2454 Factor out NextScript inline source (#4934) (#4939)
This PR factors out the inline script into an own static method; fixes #4934.
2018-08-14 11:05:25 -07:00

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))
})