There are many use cases for mocking beyond "writing to a database.
Two that immediately come to mind for our use case:
- Using a mock API for stories (Storybook, Ladle). For this use case, even if we could use a real endpoint, it wouldn't be a good idea, as one generally wants to control the data and not have some gibberish mock data created by test users.
- Endpoints that go beyond database calls. We have a use case that requires a tight integration with many AWS services, including ones that would bill you a lot, if you were just creating these resources for testing. In this case also running a live API isn't even feasible locally. And deploying an actual API can take many minutes. So you can't even tear it down for each test.
I agree on integration > mocking premise in general. But there are some cases that are just not feasible without having mocks.
Originally posted by @moltar in https://github.com/trpc/trpc/discussions/1879#discussioncomment-3395657
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too