Skip to content

Commit 78c8225

Browse files
committed
fix: less flaky test
1 parent 9f4044c commit 78c8225

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

cypress/integration/middleware/enhanced.spec.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,9 @@ describe('Enhanced middleware', () => {
1212
})
1313

1414
it('rewrites the response body', () => {
15-
cy.on('uncaught:exception', (err, runnable) => {
16-
console.log(err.message)
17-
})
1815
cy.visit('/static')
19-
cy.findByText('This was static but has been transformed in')
20-
cy.findByText("This is an ad that isn't shown by default")
16+
cy.get('#message').contains('This was static but has been transformed in')
17+
cy.contains("This is an ad that isn't shown by default")
2118
})
2219

2320
it('modifies the page props', () => {

plugin/src/middleware/response.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { ElementHandlers } from './html-rewriter'
55
// eslint-disable-next-line @typescript-eslint/no-explicit-any
66
export type NextDataTransform = <T extends { pageProps?: Record<string, any> }>(props: T) => T
77

8-
// A NextReponse that wraps the Netlify origin response
8+
// A NextResponse that wraps the Netlify origin response
99
// We can't pass it through directly, because Next disallows returning a response body
1010
export class MiddlewareResponse extends NextResponse {
1111
private readonly dataTransforms: NextDataTransform[]

0 commit comments

Comments
 (0)