-
-
Notifications
You must be signed in to change notification settings - Fork 488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
replace vitest-fetch-mock with msw #1592
replace vitest-fetch-mock with msw #1592
Conversation
|
This is a great PR, thank you! Very in favor of this direction—I had been wanting to do this but you beat me to it. I’m not so much particular about the test setup details, so long as the tests themselves don’t change. |
0445fe4
to
e07f193
Compare
This replaces vitest-fetch-mock with msw in the index.test.ts file.
Additionally ensures all clients are setup correctly for GET tests.
I don't have permissions to merge this, feel free to do so :) |
This is great, thanks again! |
got an ETA for this to be published? |
@jshike this is for testing; there’s nothing to publish |
Changes
index.bench.js
)Fixes #1581
How to Review
I've made an effort to keep the existing tests as close as possible to their original implementation, with the exception of replacing
mockFetch*
with the equivalentmsw
test handler. Due tomsw
, it's necessary to passbaseUrl
around to ensure we're using the correct request URLs. Therefore, it has been provided for eachcreateClient
and equivalent test handler.Please note, the current usage of
msw
contradictsmsw
's best practices (Avoid Request Assertions). However, given the nature of this library, I believe this approach is acceptable in this context. In most of these tests, we aim to validate that the client is indeed calling the expected handler with the expected request parameters.Checklist
docs/
updated (if necessary)