Remix.run Logo
pmg101 18 hours ago

  1. Take every single function, even private ones.
  2. Mock every argument and collaborator.
  3. Call the function.
  4. Assert the mocks were  called in the expected way.
These tests help you find inadvertent changes, yes, but they also create constant noise about changes you intend.
girvo 7 hours ago | parent | next [-]

You beat me to it, and yep these are exactly it.

“Mock the world then test your mocks”, I’m simply not convinced these have any value at all after my nearly two decades of doing this professionally

senbrow 11 hours ago | parent | prev | next [-]

These tests also break encapsulation in many cases because they're not testing the interface contract, they're testing the implementation.

ornornor 12 hours ago | parent | prev [-]

Juniors on one of the teams I work with only write this kind of tests. It’s tiring, and I have to tell them to test the behaviour, not the implementation. And yet every time they do the same thing. Or rather their AI IDE spits these out.