Skip to content

Commit

Permalink
test: update edge-runtime test
Browse files Browse the repository at this point in the history
  • Loading branch information
pieh committed Jul 26, 2024
1 parent 61fe5b9 commit 285dd28
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/fixtures/middleware-conditions/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const config = {
source: '/hello',
},
{
source: '/nl-NL/about',
source: '/nl/about',
locale: false,
},
],
Expand Down
9 changes: 6 additions & 3 deletions tests/integration/edge-handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,16 @@ describe("aborts middleware execution when the matcher conditions don't match th

ctx.cleanup?.push(() => origin.stop())

for (const path of ['/hello', '/en/hello', '/nl-NL/hello', '/nl-NL/about']) {
for (const path of ['/hello', '/en/hello', '/nl/hello', '/nl/about']) {
const response = await invokeEdgeFunction(ctx, {
functions: ['___netlify-edge-handler-middleware'],
origin,
url: path,
})
expect(response.headers.has('x-hello-from-middleware-res'), `does match ${path}`).toBeTruthy()
expect(
response.headers.has('x-hello-from-middleware-res'),
`should match ${path}`,
).toBeTruthy()
expect(await response.text()).toBe('Hello from origin!')
expect(response.status).toBe(200)
}
Expand All @@ -280,7 +283,7 @@ describe("aborts middleware execution when the matcher conditions don't match th
})
expect(
response.headers.has('x-hello-from-middleware-res'),
`does not match ${path}`,
`should not match ${path}`,
).toBeFalsy()
expect(await response.text()).toBe('Hello from origin!')
expect(response.status).toBe(200)
Expand Down

0 comments on commit 285dd28

Please sign in to comment.