News for hackers. Stuff that matters.
Re:Ask HN: Concepts that clicked only years after you first ... by delecti on Sunday January 01, 2023 @02:02PM (#34209515)
How are mocks a smell if "unit testable with (possibly fake) dependencies" is okay? That's what mocks are.

Or do you mean specifically "expecting" interactions with those mocks? Because I agree that's usually not that valuable.

Re:Ask HN: Concepts that clicked only years after you first ... by Cyph0n on Sunday January 01, 2023 @02:33PM (#34209898)
Fakes are not mocks. A fake is an actual implementation of the dependency that runs in-process/in-memory. This means that, unlike with mocks, your test code does not dictate the behavior/outputs.

Ideally, service owners would write and maintain the fake to ensure that it stays in sync as changes are made to the actual service.

Re:Ask HN: Concepts that clicked only years after you first ... by sanderjd on Sunday January 01, 2023 @02:50PM (#34210095)
Basically what Cyph0n said, fakes and mocks aren't the same thing.

But it isn't quite as smelly when I see a mock (or "stub" more typically) used as an expedient way to create a fake to pass in as a dependency.

Like you said, it is asserting on the interactions with a mock that is what primarily smells bad to me. I very rarely (honestly I think maybe never) see this done in a way that isn't just rewriting the implementation of the method as expectations in the test.