Skip to content

Commit

Permalink
test for fallback error message
Browse files Browse the repository at this point in the history
  • Loading branch information
Timer committed Feb 27, 2020
1 parent 0c8f35f commit 7495acc
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test/integration/prerender/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,36 @@ const runTests = (dev = false, looseMode = false) => {
}
})

it('should error on dynamic page without getStaticPaths returning fallback property', async () => {
const curPage = join(__dirname, '../pages/temp2/[slug].js')
await fs.mkdirp(dirname(curPage))
await fs.writeFile(
curPage,
`
export async function unstable_getStaticPaths() {
return {
paths: []
}
}
export async function unstable_getStaticProps() {
return {
props: {
hello: 'world'
}
}
}
export default () => 'oops'
`
)
await waitFor(1000)
try {
const html = await renderViaHTTP(appPort, '/temp2/hello')
expect(html).toMatch(/`fallback` key must be returned from/)
} finally {
await fs.remove(curPage)
}
})

it('should not re-call getStaticProps when updating query', async () => {
const browser = await webdriver(appPort, '/something?hello=world')
await waitFor(2000)
Expand Down

0 comments on commit 7495acc

Please sign in to comment.