Skip to content

Commit 1f99af4

Browse files
committed
test: update edge-runtime test
1 parent 61fe5b9 commit 1f99af4

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

Diff for: tests/fixtures/middleware-conditions/middleware.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const config = {
1919
source: '/hello',
2020
},
2121
{
22-
source: '/nl-NL/about',
22+
source: '/nl/about',
2323
locale: false,
2424
},
2525
],

Diff for: tests/integration/edge-handler.test.ts

+7-4
Original file line numberDiff line numberDiff line change
@@ -261,26 +261,29 @@ describe("aborts middleware execution when the matcher conditions don't match th
261261

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

264-
for (const path of ['/hello', '/en/hello', '/nl-NL/hello', '/nl-NL/about']) {
264+
for (const path of ['/hello', '/en/hello', '/nl/hello', '/nl/about']) {
265265
const response = await invokeEdgeFunction(ctx, {
266266
functions: ['___netlify-edge-handler-middleware'],
267267
origin,
268268
url: path,
269269
})
270-
expect(response.headers.has('x-hello-from-middleware-res'), `does match ${path}`).toBeTruthy()
270+
expect(
271+
response.headers.has('x-hello-from-middleware-res'),
272+
`should match ${path}`,
273+
).toBeTruthy()
271274
expect(await response.text()).toBe('Hello from origin!')
272275
expect(response.status).toBe(200)
273276
}
274277

275-
for (const path of ['/hello/invalid', '/about', '/en/about']) {
278+
for (const path of ['/invalid/hello', '/hello/invalid', '/about', '/en/about']) {
276279
const response = await invokeEdgeFunction(ctx, {
277280
functions: ['___netlify-edge-handler-middleware'],
278281
origin,
279282
url: path,
280283
})
281284
expect(
282285
response.headers.has('x-hello-from-middleware-res'),
283-
`does not match ${path}`,
286+
`should not match ${path}`,
284287
).toBeFalsy()
285288
expect(await response.text()).toBe('Hello from origin!')
286289
expect(response.status).toBe(200)

0 commit comments

Comments
 (0)