pingdotgg / uploadthing

File uploads for modern web devs
https://uploadthing.com
MIT License
4.19k stars 312 forks source link

test: describe network using only msw #711

Closed juliusmarminge closed 7 months ago

juliusmarminge commented 7 months ago

trying to get rid of our mockExternalRequest(db) in favor of only using msw to describe all the external requests, no matter if the method accepts a fetch override or not.

it's going.... well not so good 😓

changeset-bot[bot] commented 7 months ago

⚠️ No Changeset found

Latest commit: 3eac0e536fd5c83f1be97730d84a97780f040d59

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

vercel[bot] commented 7 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs-uploadthing ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 24, 2024 11:40am
juliusmarminge commented 7 months ago

UPDATE: I think I got a quite clean solution now.

Tests consuming the db context will now prepend UTApiMocks to the msw listeners with that db instance. No need to provide any fetch overrides etc etc, just destruct the db from the context and all should work automatically

kettanaito commented 7 months ago

🚀