Skip to content

Commit

Permalink
test: remove tests that don't make sense anymore and update some othe…
Browse files Browse the repository at this point in the history
…r ones
  • Loading branch information
pieh committed Jan 3, 2025
1 parent 4289aa2 commit a1d859d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 23 deletions.
11 changes: 4 additions & 7 deletions tests/integration/edge-handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,7 @@ describe('page router', () => {
})
const res = await response.json()
const url = new URL(res.url, 'http://n/')
expect(url.pathname).toBe('/ssr-page-2/')
expect(url.searchParams.get('__nextDataReq')).toBe('1')
expect(url.pathname).toBe('/_next/data/build-id/ssr-page-2.json')
expect(res.headers['x-nextjs-data']).toBe('1')
expect(response.headers.get('x-nextjs-rewrite')).toBe('/ssr-page-2/')
expect(response.status).toBe(200)
Expand Down Expand Up @@ -420,7 +419,7 @@ describe('page router', () => {
expect(response.status).toBe(200)
})

test<FixtureTestContext>('should rewrite un-rewritten data requests to page route', async (ctx) => {
test<FixtureTestContext>('should NOT rewrite un-rewritten data requests to page route', async (ctx) => {
await createFixture('middleware-pages', ctx)
await runPlugin(ctx)
const origin = await LocalServer.run(async (req, res) => {
Expand All @@ -443,8 +442,7 @@ describe('page router', () => {
})
const res = await response.json()
const url = new URL(res.url, 'http://n/')
expect(url.pathname).toBe('/ssg/hello/')
expect(url.searchParams.get('__nextDataReq')).toBe('1')
expect(url.pathname).toBe('/_next/data/build-id/ssg/hello.json')
expect(res.headers['x-nextjs-data']).toBe('1')
expect(response.status).toBe(200)
})
Expand Down Expand Up @@ -472,8 +470,7 @@ describe('page router', () => {
})
const res = await response.json()
const url = new URL(res.url, 'http://n/')
expect(url.pathname).toBe('/blog/first/')
expect(url.searchParams.get('__nextDataReq')).toBe('1')
expect(url.pathname).toBe('/_next/data/build-id/blog/first.json')
expect(url.searchParams.get('slug')).toBe('first')
expect(res.headers['x-nextjs-data']).toBe('1')
expect(response.status).toBe(200)
Expand Down
16 changes: 0 additions & 16 deletions tests/integration/page-router.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,22 +95,6 @@ test<FixtureTestContext>('Should revalidate path with On-demand Revalidation', a
expect(dateCacheInitial).not.toBe(dateCacheRevalidated)
})

test<FixtureTestContext>('Should return JSON for data req to page route', async (ctx) => {
await createFixture('page-router', ctx)
await runPlugin(ctx)

const response = await invokeFunction(ctx, {
url: '/static/revalidate-manual?__nextDataReq=1',
headers: { 'x-nextjs-data': '1' },
})

expect(response.body).toMatch(/^{"pageProps":/)

const data = JSON.parse(response.body)

expect(data.pageProps.show).toBeDefined()
})

test.skipIf(platform === 'win32')<FixtureTestContext>(
'Should set permanent "netlify-cdn-cache-control" header on fully static pages"',
async (ctx) => {
Expand Down

0 comments on commit a1d859d

Please sign in to comment.