Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration tests, and update
.gitignore
- Loading branch information
Alex Newman
authored and
Alex Newman
committed
Apr 3, 2017
1 parent
34e5c08
commit 376f325
Showing
5 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,5 @@ npm-debug.log | |
# coverage | ||
.nyc_output | ||
coverage | ||
|
||
.DS_Store |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
onDemandEntries: { | ||
// Make sure entries are not getting disposed. | ||
maxInactiveAge: 1000 * 60 * 60 | ||
}, | ||
distDir: 'dist' | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default () => ( | ||
<div>Hello World</div> | ||
) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* global jasmine, describe, it, expect, beforeAll, afterAll */ | ||
|
||
import { join } from 'path' | ||
import { existsSync } from 'fs' | ||
import { | ||
nextServer, | ||
nextBuild, | ||
startApp, | ||
stopApp, | ||
renderViaHTTP | ||
} from 'next-test-utils' | ||
|
||
const appDir = join(__dirname, '../') | ||
let appPort | ||
let server | ||
let app | ||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 40000 | ||
|
||
describe('Production Usage', () => { | ||
beforeAll(async () => { | ||
await nextBuild(appDir) | ||
app = nextServer({ | ||
dir: join(__dirname, '../'), | ||
dev: false, | ||
quiet: true | ||
}) | ||
|
||
server = await startApp(app) | ||
appPort = server.address().port | ||
}) | ||
afterAll(() => stopApp(server)) | ||
|
||
describe('With basic usage', () => { | ||
it('should render the page', async () => { | ||
const html = await renderViaHTTP(appPort, '/') | ||
expect(html).toMatch(/Hello World/) | ||
}) | ||
}) | ||
|
||
describe('File locations', () => { | ||
it('should build the app within the given `dist` directory', () => { | ||
expect(existsSync(join(__dirname, '/../dist/app.js'))).toBeTruthy() | ||
}) | ||
|
||
it('should not build the app within the default `.next` directory', () => { | ||
expect(existsSync(join(__dirname, '/../.next/app.js'))).toBeFalsy() | ||
}) | ||
}) | ||
}) |