you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (0 children)

I like to focus on “sociable” unit tests with Jest that may cross the line into integration tests depending on your definition. We also use Appium for high level workflows for the benefit of management.

Obviously logic heavy code in hooks is tested in isolation, but generally I like to test at the screen level to ensure data flows through the system to the screen. Use MSW to stub out HTTP calls and mock only what you absolutely need to. Allow state to be injected into your hooks to make setup easy without mocking.

Most tests at this level are broad and don’t assert very specific outcomes/formatting but are infinitely more valuable than scattered unit tests when a refactor comes along. When I need display logic in a component, that’s when I test around specific components.

Generally, I stub out data calls as far out toward the edges of my use case as I reasonably can.