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/basic/test/index.test.js
Tim Neutkens 449f38daa7
Make sure props.url is immutable (#4352)
* Make sure props.url is immutable

* Add test for immutable url

* Match object instead of string
2018-05-12 20:10:17 +02:00

74 lines
2.8 KiB
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 clientNavigation from './client-navigation'
import hmr from './hmr'
import errorRecovery from './error-recovery'
import dynamic from './dynamic'
import asset from './asset'
const context = {}
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5
describe('Basic Features', () => {
beforeAll(async () => {
context.appPort = await findPort()
context.server = await launchApp(join(__dirname, '../'), context.appPort, true)
// pre-build all pages at the start
await Promise.all([
renderViaHTTP(context.appPort, '/async-props'),
renderViaHTTP(context.appPort, '/empty-get-initial-props'),
renderViaHTTP(context.appPort, '/error'),
renderViaHTTP(context.appPort, '/finish-response'),
renderViaHTTP(context.appPort, '/head'),
renderViaHTTP(context.appPort, '/json'),
renderViaHTTP(context.appPort, '/link'),
renderViaHTTP(context.appPort, '/stateful'),
renderViaHTTP(context.appPort, '/stateless'),
renderViaHTTP(context.appPort, '/fragment-syntax'),
renderViaHTTP(context.appPort, '/custom-extension'),
renderViaHTTP(context.appPort, '/styled-jsx'),
renderViaHTTP(context.appPort, '/with-cdm'),
renderViaHTTP(context.appPort, '/url-prop'),
renderViaHTTP(context.appPort, '/url-prop-override'),
renderViaHTTP(context.appPort, '/nav'),
renderViaHTTP(context.appPort, '/nav/about'),
renderViaHTTP(context.appPort, '/nav/querystring'),
renderViaHTTP(context.appPort, '/nav/self-reload'),
renderViaHTTP(context.appPort, '/nav/hash-changes'),
renderViaHTTP(context.appPort, '/nav/shallow-routing'),
renderViaHTTP(context.appPort, '/nav/redirect'),
renderViaHTTP(context.appPort, '/nav/as-path'),
renderViaHTTP(context.appPort, '/nav/as-path-using-router'),
renderViaHTTP(context.appPort, '/nav/url-prop-change'),
renderViaHTTP(context.appPort, '/nested-cdm/index'),
renderViaHTTP(context.appPort, '/hmr/about'),
renderViaHTTP(context.appPort, '/hmr/style'),
renderViaHTTP(context.appPort, '/hmr/contact'),
renderViaHTTP(context.appPort, '/hmr/counter')
])
})
afterAll(() => killApp(context.server))
rendering(context, 'Rendering via HTTP', (p, q) => renderViaHTTP(context.appPort, p, q), (p, q) => fetchViaHTTP(context.appPort, p, q))
clientNavigation(context, (p, q) => renderViaHTTP(context.appPort, p, q))
dynamic(context, (p, q) => renderViaHTTP(context.appPort, p, q))
hmr(context, (p, q) => renderViaHTTP(context.appPort, p, q))
errorRecovery(context, (p, q) => renderViaHTTP(context.appPort, p, q))
asset(context)
})