Update middleware matcher e2e test (#37694)

This commit is contained in:
JJ Kasper 2022-06-14 15:11:36 -05:00 committed by GitHub
parent b65e10ea7a
commit f17f1d4e56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,7 +30,9 @@ describe('Middleware can set the matcher in its config', () => {
it('adds the header for a matched data path', async () => {
const response = await fetchViaHTTP(
next.url,
`/_next/data/${next.buildId}/with-middleware.json`
`/_next/data/${next.buildId}/with-middleware.json`,
undefined,
{ headers: { 'x-nextjs-data': '1' } }
)
expect(await response.json()).toMatchObject({
pageProps: {
@ -51,7 +53,9 @@ describe('Middleware can set the matcher in its config', () => {
it('adds the header for another matched data path', async () => {
const response = await fetchViaHTTP(
next.url,
`/_next/data/${next.buildId}/another-middleware.json`
`/_next/data/${next.buildId}/another-middleware.json`,
undefined,
{ headers: { 'x-nextjs-data': '1' } }
)
expect(await response.json()).toMatchObject({
pageProps: {
@ -64,7 +68,9 @@ describe('Middleware can set the matcher in its config', () => {
it('does not add the header for root data request', async () => {
const response = await fetchViaHTTP(
next.url,
`/_next/data/${next.buildId}/index.json`
`/_next/data/${next.buildId}/index.json`,
undefined,
{ headers: { 'x-nextjs-data': '1' } }
)
expect(await response.json()).toMatchObject({
pageProps: {
@ -176,7 +182,9 @@ describe('using a single matcher', () => {
it('adds the headers for a matched data path', async () => {
const response = await fetchViaHTTP(
next.url,
`/_next/data/${next.buildId}/middleware/works.json`
`/_next/data/${next.buildId}/middleware/works.json`,
undefined,
{ headers: { 'x-nextjs-data': '1' } }
)
expect(await response.json()).toMatchObject({
pageProps: {