/* global expect, jasmine, describe, test, beforeAll, afterAll */
'use strict'
import { join } from 'path'
import next from '../dist/server/next'
import pkg from '../package.json'
const dir = join(__dirname, 'fixtures', 'basic')
const app = next({
dir,
dev: true,
staticMarkup: true,
quiet: true
})
jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000
describe('integration tests', () => {
beforeAll(() => app.prepare())
afterAll(() => app.close())
test('renders a stateless component', async () => {
const html = await render('/stateless')
expect(html.includes('')).toBeTruthy()
expect(html.includes('
My component!
')).toBeTruthy()
})
test('renders a stateful component', async () => {
const html = await render('/stateful')
expect(html.includes('')).toBeTruthy()
})
test('header helper renders header information', async () => {
const html = await (render('/head'))
expect(html.includes('')).toBeTruthy()
expect(html.includes('')).toBeTruthy()
expect(html.includes('I can haz meta tags
')).toBeTruthy()
})
test('css helper renders styles', async () => {
const html = await render('/css')
expect(/\.css-\w+/.test(html)).toBeTruthy()
expect(/This is red<\/div>/.test(html)).toBeTruthy()
})
test('renders styled jsx', async () => {
const html = await render('/styled-jsx')
expect(html).toMatch(/