Unverified Commit 5b5d72ba authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Fix buildId being escaped breaking test with certain build ids (#10728)

parent 0ff41daa
...@@ -209,10 +209,7 @@ const runTests = (dev = false) => { ...@@ -209,10 +209,7 @@ const runTests = (dev = false) => {
expect(JSON.parse(query)).toEqual({ path: ['first'] }) expect(JSON.parse(query)).toEqual({ path: ['first'] })
const data = JSON.parse( const data = JSON.parse(
await renderViaHTTP( await renderViaHTTP(appPort, `/_next/data/${buildId}/catchall/first.json`)
appPort,
`/_next/data/${escapeRegex(buildId)}/catchall/first.json`
)
) )
expect(data.pageProps.params).toEqual({ path: ['first'] }) expect(data.pageProps.params).toEqual({ path: ['first'] })
...@@ -220,10 +217,7 @@ const runTests = (dev = false) => { ...@@ -220,10 +217,7 @@ const runTests = (dev = false) => {
it('should return data correctly', async () => { it('should return data correctly', async () => {
const data = JSON.parse( const data = JSON.parse(
await renderViaHTTP( await renderViaHTTP(appPort, `/_next/data/${buildId}/something.json`)
appPort,
`/_next/data/${escapeRegex(buildId)}/something.json`
)
) )
expect(data.pageProps.world).toBe('world') expect(data.pageProps.world).toBe('world')
}) })
...@@ -232,7 +226,7 @@ const runTests = (dev = false) => { ...@@ -232,7 +226,7 @@ const runTests = (dev = false) => {
const data = JSON.parse( const data = JSON.parse(
await renderViaHTTP( await renderViaHTTP(
appPort, appPort,
`/_next/data/${escapeRegex(buildId)}/something.json?another=thing` `/_next/data/${buildId}/something.json?another=thing`
) )
) )
expect(data.pageProps.query.another).toBe('thing') expect(data.pageProps.query.another).toBe('thing')
...@@ -240,10 +234,7 @@ const runTests = (dev = false) => { ...@@ -240,10 +234,7 @@ const runTests = (dev = false) => {
it('should return data correctly for dynamic page', async () => { it('should return data correctly for dynamic page', async () => {
const data = JSON.parse( const data = JSON.parse(
await renderViaHTTP( await renderViaHTTP(appPort, `/_next/data/${buildId}/blog/post-1.json`)
appPort,
`/_next/data/${escapeRegex(buildId)}/blog/post-1.json`
)
) )
expect(data.pageProps.post).toBe('post-1') expect(data.pageProps.post).toBe('post-1')
}) })
...@@ -389,7 +380,7 @@ const runTests = (dev = false) => { ...@@ -389,7 +380,7 @@ const runTests = (dev = false) => {
it('should set no-cache, no-store, must-revalidate header', async () => { it('should set no-cache, no-store, must-revalidate header', async () => {
const res = await fetchViaHTTP( const res = await fetchViaHTTP(
appPort, appPort,
`/_next/data/${escapeRegex(buildId)}/something.json` `/_next/data/${buildId}/something.json`
) )
expect(res.headers.get('cache-control')).toContain('no-cache') expect(res.headers.get('cache-control')).toContain('no-cache')
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment