Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Apr 9, 2024
1 parent cf2f685 commit 5b1c672
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 26 deletions.
36 changes: 23 additions & 13 deletions test/e2e/middleware-general/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,19 +166,29 @@ describe('Middleware Runtime', () => {
const manifest = await fs.readJSON(
join(next.testDir, '.next/server/middleware-manifest.json')
)
expect(manifest.middleware).toEqual({
'/': {
files: expect.arrayContaining([
'server/edge-runtime-webpack.js',
'server/middleware.js',
]),
name: 'middleware',
page: '/',
matchers: [{ regexp: '^/.*$', originalSource: '/:path*' }],
wasm: [],
assets: [],
regions: 'auto',
},
const middlewareWithoutEnvs = {
...manifest.middleware['/'],
}
const envs = {
...middlewareWithoutEnvs.environments,
}
delete middlewareWithoutEnvs.environments
expect(middlewareWithoutEnvs).toEqual({
files: expect.arrayContaining([
'server/edge-runtime-webpack.js',
'server/middleware.js',
]),
name: 'middleware',
page: '/',
matchers: [{ regexp: '^/.*$', originalSource: '/:path*' }],
wasm: [],
assets: [],
regions: 'auto',
})
expect(envs).toMatchObject({
previewModeEncryptionKey: 'string',
previewModeId: 'string',
previewModeSigningKey: 'string',
})
})

Expand Down
28 changes: 15 additions & 13 deletions test/e2e/middleware-trailing-slash/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,21 @@ describe('Middleware Runtime trailing slash', () => {
const manifest = await fs.readJSON(
join(next.testDir, '.next/server/middleware-manifest.json')
)
expect(manifest.middleware).toEqual({
'/': {
files: expect.arrayContaining([
'prerender-manifest.js',
'server/edge-runtime-webpack.js',
'server/middleware.js',
]),
name: 'middleware',
page: '/',
matchers: [{ regexp: '^/.*$', originalSource: '/:path*' }],
wasm: [],
assets: [],
},
const middlewareWithoutEnvs = {
...manifest.middleware['/'],
}
delete middlewareWithoutEnvs.environments
expect(middlewareWithoutEnvs).toEqual({
files: expect.arrayContaining([
'prerender-manifest.js',
'server/edge-runtime-webpack.js',
'server/middleware.js',
]),
name: 'middleware',
page: '/',
matchers: [{ regexp: '^/.*$', originalSource: '/:path*' }],
wasm: [],
assets: [],
})
})

Expand Down

0 comments on commit 5b1c672

Please sign in to comment.