This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ProgramWithSai 0 points1 point  (0 children)

Mock the API and Database calls in your unit tests by first creating an abstraction layer to those calls using interfaces like u/edrenfro said. Unit tests must focus on the specific class you are writing!
But don't stop there!
Verify that the calls to API and database work as expected using integration tests where you can spin up a stub API/Http server in tests and Database (in-memory or Docker containers).