提交 e28de80d 编写于 作者: J JJ Kasper 提交者: Joe Haddad

Fix up errors in tests (#9407)

* Fix up errors in tests

* Fix test

* Apply suggestions from code review

* Update require-page.test.js

* Update require-page.test.js
上级 f910a92f
......@@ -119,14 +119,14 @@ export default function({ app }, suiteName, render, fetch) {
describe('_app', () => {
test('It shows a custom tag', async () => {
const $ = await get$('/')
expect($('hello-app').text() === 'Hello App')
expect($('#hello-app').text()).toBe('Hello App')
})
// For example react context uses shared module state
// Also known as singleton modules
test('It should share module state with pages', async () => {
const $ = await get$('/shared')
expect($('#currentstate').text() === 'UPDATED')
expect($('#currentstate').text()).toBe('UPDATED')
})
test('It should show valid error when thrown in _app getInitialProps', async () => {
......
......@@ -11,7 +11,6 @@ import {
killApp,
renderViaHTTP,
waitFor,
killAll,
} from 'next-test-utils'
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 1
......@@ -68,7 +67,7 @@ describe('AppTree', () => {
appPort = await findPort()
app = await nextStart(appDir, appPort)
})
afterAll(() => killAll(app))
afterAll(() => killApp(app))
runTests()
})
......
......@@ -8,7 +8,6 @@ import {
launchApp,
killApp,
renderViaHTTP,
killAll,
File,
} from 'next-test-utils'
......@@ -46,7 +45,7 @@ describe('Custom page extension', () => {
appPort = await findPort()
app = await nextStart(appDir, appPort)
})
afterAll(() => killAll(app))
afterAll(() => killApp(app))
runTests()
})
......
......@@ -21,8 +21,9 @@ const pathToBundles = join(
describe('pageNotFoundError', () => {
it('Should throw error with ENOENT code', () => {
expect.assertions(1)
try {
pageNotFoundError('test')
throw pageNotFoundError('test')
} catch (err) {
expect(err.code).toBe('ENOENT')
}
......@@ -84,6 +85,7 @@ describe('requirePage', () => {
})
it('Should throw when using /../../test.js', async () => {
expect.assertions(1)
try {
await requirePage('/../../test', distDir)
} catch (err) {
......@@ -92,6 +94,7 @@ describe('requirePage', () => {
})
it('Should throw when using non existent pages like /non-existent.js', async () => {
expect.assertions(1)
try {
await requirePage('/non-existent', distDir)
} catch (err) {
......@@ -100,6 +103,7 @@ describe('requirePage', () => {
})
it('Should bubble up errors in the child component', async () => {
expect.assertions(1)
try {
await requirePage('/non-existent-child', distDir)
} catch (err) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册