Skip to content

Commit fafb466

Browse files
ijjktimneutkens
authored andcommitted
Test failed SSG data request (vercel#9738)
1 parent a12030b commit fafb466

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

test/integration/prerender/pages/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ const Page = ({ world, time }) => {
2929
<Link href="/blog/[post]" as="/blog/post-1">
3030
<a id="post-1">to dynamic</a>
3131
</Link>
32+
<Link href="/blog/[post]" as="/blog/post-100">
33+
<a id="broken-post">to broken</a>
34+
</Link>
3235
<br />
3336
<Link href="/blog/[post]/[comment]" as="/blog/post-1/comment-1">
3437
<a id="comment-1">to another dynamic</a>

test/integration/prerender/test/index.test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,15 @@ const runTests = (dev = false) => {
261261
expect(text).toMatch(/post.*?post-1/)
262262
})
263263

264+
it('should reload page on failed data request', async () => {
265+
const browser = await webdriver(appPort, '/')
266+
await waitFor(500)
267+
await browser.eval('window.beforeClick = true')
268+
await browser.click('#broken-post')
269+
await waitFor(1000)
270+
expect(await browser.eval('window.beforeClick')).not.toBe('true')
271+
})
272+
264273
if (dev) {
265274
it('should always call getStaticProps without caching in dev', async () => {
266275
const initialRes = await fetchViaHTTP(appPort, '/something')

0 commit comments

Comments
 (0)