11. Logic is easy to unit test if it is stateless and side-effect free. Break out logic into separate functions, rather than mixing logic into stateful and side-effect-filled code. Separating stateful code and code with side-effects into smaller functions makes them easier to mock out and unit test without side-effects. (Less overhead for tests means faster tests.) Side effects *do* need testing, but testing them once and mocking them out everywhere else is generally a good pattern.
XFEDI
ActivityPubConversation
No replies here yet.