mirror of
https://github.com/hanzoai/msw.git
synced 2026-09-24 17:00:34 +00:00
20 lines
492 B
TypeScript
20 lines
492 B
TypeScript
import { expect, test } from '../../playwright.extend'
|
|
|
|
for (const code of [204, 205, 304]) {
|
|
test(`gracefully handles a ${code} response null body during life-cycle events`, async ({
|
|
loadExample,
|
|
fetch,
|
|
page,
|
|
}) => {
|
|
await loadExample(new URL('./null-body.mocks.ts', import.meta.url))
|
|
|
|
const errors: Array<Error> = []
|
|
page.on('pageerror', (pageError) => {
|
|
errors.push(pageError)
|
|
})
|
|
|
|
await fetch(`/api/${code}`)
|
|
expect(errors).toEqual([])
|
|
})
|
|
}
|