1
0
Fork 0
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:
Arunoda Susiripala 2017-05-09 18:28:15 -07:00
parent 7b193f1aa7
commit 56dc85485f
2 changed files with 24 additions and 7 deletions

View file

@ -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 () => {

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