mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Add ssr tests for next-export
This commit is contained in:
parent
7b193f1aa7
commit
56dc85485f
|
@ -4,12 +4,13 @@ import { join } from 'path'
|
|||
import {
|
||||
nextBuild,
|
||||
nextExport,
|
||||
renderViaHTTP,
|
||||
startStaticServer,
|
||||
stopApp
|
||||
} from 'next-test-utils'
|
||||
import webdriver from 'next-webdriver'
|
||||
|
||||
import ssr from './ssr'
|
||||
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 40000
|
||||
const appDir = join(__dirname, '../')
|
||||
const context = {}
|
||||
|
@ -25,12 +26,7 @@ describe('Static Export', () => {
|
|||
})
|
||||
afterAll(() => stopApp(context.server))
|
||||
|
||||
describe('Render via SSR', () => {
|
||||
it('should render the home page', async () => {
|
||||
const html = await renderViaHTTP(context.port, '/')
|
||||
expect(html).toMatch(/This is the home page/)
|
||||
})
|
||||
})
|
||||
ssr(context)
|
||||
|
||||
describe('Render via browser', () => {
|
||||
it('should render the home page', async () => {
|
||||
|
|
21
test/integration/static/test/ssr.js
Normal file
21
test/integration/static/test/ssr.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
/* global describe, it, expect */
|
||||
import { renderViaHTTP } from 'next-test-utils'
|
||||
|
||||
export default function (context) {
|
||||
describe('Render via SSR', () => {
|
||||
it('should render the home page', async () => {
|
||||
const html = await renderViaHTTP(context.port, '/')
|
||||
expect(html).toMatch(/This is the home page/)
|
||||
})
|
||||
|
||||
it('should render a page with getInitialProps', async() => {
|
||||
const html = await renderViaHTTP(context.port, '/dynamic')
|
||||
expect(html).toMatch(/cool dynamic text/)
|
||||
})
|
||||
|
||||
it('should render a dynamically rendered custom url page', async() => {
|
||||
const html = await renderViaHTTP(context.port, '/dynamic/one')
|
||||
expect(html).toMatch(/next export is nice/)
|
||||
})
|
||||
})
|
||||
}
|
Loading…
Reference in a new issue