Skip to content

Instantly share code, notes, and snippets.

@bcoe
Created December 17, 2016 21:38
Show Gist options
  • Save bcoe/148e39fd4131655ee2dba5efda4bfd38 to your computer and use it in GitHub Desktop.
Save bcoe/148e39fd4131655ee2dba5efda4bfd38 to your computer and use it in GitHub Desktop.
search.test.js
/* global expect, jasmine, describe, test, beforeAll, afterAll */
'use strict'
import next from 'next/dist/server/next'
const app = new next({
dir: './',
dev: true,
staticMarkup: true,
quiet: true
})
process.env.API = 'http://search.example.com/search'
jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000
describe('integration tests', () => {
beforeAll(() => app.prepare())
afterAll(() => app.close())
it('exposes /search endpoint', async () => {
const html = await app.renderToHTML({url: '/search', headers: {}}, {}, '/search', {})
expect(html).toMatch(/<h1>[0-9]+ results.*<\/h1>/)
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment