From cd63b0f5321b4314f0ca63a131de24ee6e555b16 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Tue, 22 Mar 2022 16:56:16 -0500 Subject: [PATCH] apply test changes to i18n suite as well --- .../required-server-files-i18n.test.ts | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/test/production/required-server-files-i18n.test.ts b/test/production/required-server-files-i18n.test.ts index 43303acf2485..b74cd9bd9f0d 100644 --- a/test/production/required-server-files-i18n.test.ts +++ b/test/production/required-server-files-i18n.test.ts @@ -162,6 +162,8 @@ describe('should set-up next', () => { const res2 = await fetchViaHTTP(appPort, '/gssp', undefined, { redirect: 'manual ', }) + await next.patchFile('standalone/data.txt', 'show') + expect(res2.status).toBe(404) expect(res2.headers.get('cache-control')).toBe( 's-maxage=1, stale-while-revalidate' @@ -169,18 +171,18 @@ describe('should set-up next', () => { }) it('should render SSR page correctly', async () => { - const html = await renderViaHTTP(appPort, '/') + const html = await renderViaHTTP(appPort, '/gssp') const $ = cheerio.load(html) const data = JSON.parse($('#props').text()) - expect($('#index').text()).toBe('index page') + expect($('#gssp').text()).toBe('getServerSideProps page') expect(data.hello).toBe('world') - const html2 = await renderViaHTTP(appPort, '/') + const html2 = await renderViaHTTP(appPort, '/gssp') const $2 = cheerio.load(html2) const data2 = JSON.parse($2('#props').text()) - expect($2('#index').text()).toBe('index page') + expect($2('#gssp').text()).toBe('getServerSideProps page') expect(isNaN(data2.random)).toBe(false) expect(data2.random).not.toBe(data.random) }) @@ -244,24 +246,24 @@ describe('should set-up next', () => { it('should render SSR page correctly with x-matched-path', async () => { const html = await renderViaHTTP(appPort, '/some-other-path', undefined, { headers: { - 'x-matched-path': '/', + 'x-matched-path': '/gssp', }, }) const $ = cheerio.load(html) const data = JSON.parse($('#props').text()) - expect($('#index').text()).toBe('index page') + expect($('#gssp').text()).toBe('getServerSideProps page') expect(data.hello).toBe('world') const html2 = await renderViaHTTP(appPort, '/some-other-path', undefined, { headers: { - 'x-matched-path': '/', + 'x-matched-path': '/gssp', }, }) const $2 = cheerio.load(html2) const data2 = JSON.parse($2('#props').text()) - expect($2('#index').text()).toBe('index page') + expect($2('#gssp').text()).toBe('getServerSideProps page') expect(isNaN(data2.random)).toBe(false) expect(data2.random).not.toBe(data.random) }) @@ -508,7 +510,7 @@ describe('should set-up next', () => { }, { headers: { - 'x-matched-path': '/', + 'x-matched-path': '/gssp', }, } )