diff --git a/test/integration/prerender/pages/catchall/[...slug].js b/test/integration/prerender/pages/catchall/[...slug].js index c2ff67739caf..b0010c612446 100644 --- a/test/integration/prerender/pages/catchall/[...slug].js +++ b/test/integration/prerender/pages/catchall/[...slug].js @@ -29,5 +29,5 @@ export default ({ slug }) => { if (isFallback) { return

fallback

} - return

Hi {slug.join('/')}

+ return

Hi {slug.join(' ')}

} diff --git a/test/integration/prerender/test/index.test.js b/test/integration/prerender/test/index.test.js index bb2350a74c78..638151a5b335 100644 --- a/test/integration/prerender/test/index.test.js +++ b/test/integration/prerender/test/index.test.js @@ -376,7 +376,7 @@ const runTests = (dev = false) => { .text() ).isFallback ).toBe(false) - expect($('#catchall').text()).toMatch(/Hi.*?another\/value/) + expect($('#catchall').text()).toMatch(/Hi.*?another value/) }) it('should support lazy catchall route', async () => { @@ -405,6 +405,38 @@ const runTests = (dev = false) => { } }) + it('should support nested lazy catchall route', async () => { + // Dev doesn't support fallback yet + if (dev) { + const html = await renderViaHTTP( + appPort, + '/catchall/notreturnedinpaths/nested' + ) + const $ = cheerio.load(html) + expect($('#catchall').text()).toMatch(/Hi.*?notreturnedinpaths nested/) + } + // Production will render fallback for a "lazy" route + else { + const html = await renderViaHTTP( + appPort, + '/catchall/notreturnedinpaths/nested' + ) + const $ = cheerio.load(html) + expect($('#catchall').text()).toBe('fallback') + + // hydration + const browser = await webdriver(appPort, '/catchall/delayby3s/nested') + + const text1 = await browser.elementByCss('#catchall').text() + expect(text1).toBe('fallback') + + await new Promise(resolve => setTimeout(resolve, 4000)) + + const text2 = await browser.elementByCss('#catchall').text() + expect(text2).toMatch(/Hi.*?delayby3s nested/) + } + }) + if (dev) { // TODO: re-enable when this is supported in dev // it('should show error when rewriting to dynamic SSG page', async () => {