-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: upgrade to msw 2.x * chore: get all tests to pass * chore: update README.md * chore: bump peer dependencies * chore: update file name to reflect msw api change * chore: update yarn.lock * chore: set required node version to >=18 BREAKING CHANGE: Due to the updated dependency msw 2, using playwright-msw requires node 18 or newer * refactor: use crypto's randomUUID instead of rolling it ourselves * fix: actually log active handlers * docs: use "realistic" delay in examples * refactor: use HttpResponse instead of Response for future extensibility * chore: add yarn cache to gitignore * docs: remove redundant word * refactor: use static factory where applicable * chore: remove unnecessary isNullArray --------- Co-authored-by: Martin Dennhardt <[email protected]>
- Loading branch information
Showing
32 changed files
with
1,633 additions
and
1,269 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
14.18.1 | ||
lts/hydrogen |
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 |
---|---|---|
|
@@ -12,5 +12,6 @@ node_modules | |
.gitignore | ||
.gitkeep | ||
.github/CODEOWNERS | ||
.nvmrc | ||
*.svg | ||
*.zip |
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,11 +1,16 @@ | ||
import { rest } from 'msw'; | ||
import { http, delay, HttpResponse } from 'msw'; | ||
|
||
export const testHandlers = [ | ||
rest.get('/api/users', async (_, response, context) => { | ||
return response( | ||
context.status(200), | ||
context.delay(500), | ||
context.json([{ name: 'Harry' }, { name: 'Ron' }, { name: 'Hermione' }]) | ||
); | ||
}), | ||
http.get( | ||
'/api/users', | ||
|
||
async () => { | ||
await delay(); | ||
return HttpResponse.json([ | ||
{ name: 'Harry' }, | ||
{ name: 'Ron' }, | ||
{ name: 'Hermione' }, | ||
]); | ||
} | ||
), | ||
]; |
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
Oops, something went wrong.