Created
December 17, 2016 21:38
-
-
Save bcoe/148e39fd4131655ee2dba5efda4bfd38 to your computer and use it in GitHub Desktop.
search.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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