Remix.run Logo
instig007 4 days ago

> And time spent on designing and writing type safe code is almost equivalent to time spent writing tests that serve as an end-to-end contract.

Do you write tests for every third-party function that interacts with your code, so that it never fails in runtime after a version bump?

How do you guarantee that your own refactoring is exhaustively covered by the prior tests you've written for the old version?

zdragnar 4 days ago | parent [-]

You don't need a test for every function. You probably want every function call covered by a test, though, otherwise you have untested code.

The exact granularity is a debate that has gone on for a long time. Nowadays, people seem to prefer larger tests that cover more code in one go so as to avoid lots of mocking / stubbing. Super granular tests tend to be reserved for libraries with no internal state.

epgui 4 days ago | parent [-]

While what you say could be argued, this is both an insufficient argument against, and irrelevant to, the post you’re commenting on.