-
-
Notifications
You must be signed in to change notification settings - Fork 519
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: null-body responses enforced in createResponseListener instead o… (
- Loading branch information
1 parent
b440f12
commit ed09722
Showing
8 changed files
with
152 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
import { sleep } from '../../../support/utils' | ||
import { test, expect } from '../../playwright.extend' | ||
import { expect, test } from '../../playwright.extend' | ||
|
||
test('gracefully handles a 204 response null body during life-cycle events', async ({ | ||
loadExample, | ||
fetch, | ||
page, | ||
}) => { | ||
await loadExample(require.resolve('./null-body.mocks.ts')) | ||
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(require.resolve('./null-body.mocks.ts')) | ||
|
||
const errors: Array<Error> = [] | ||
page.on('pageerror', (pageError) => { | ||
errors.push(pageError) | ||
}) | ||
|
||
await fetch('/api/books') | ||
await sleep(500) | ||
const errors: Array<Error> = [] | ||
page.on('pageerror', (pageError) => { | ||
errors.push(pageError) | ||
}) | ||
|
||
expect(errors).toEqual([]) | ||
}) | ||
await fetch(`/api/${code}`) | ||
expect(errors).toEqual([]) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters