Amy Blankenship
Jun 14, 2022

--

Data is just another type of dependency. And mocks are something you put in place so that you really nail down what specific data is going to come out of a dependency so that you exercise all your edge cases. Yes, it's better if all your code takes its inputs as "purely" as possible, but often that's not feasible (for example, you might not own the piece of code that you have to mock so you can't refactor it, or that code has already been through QA so there's unacceptable friction around refactoring it to be more pure).

And you might live in a world where you never have to work around the vagaries of management whose priorities don't align with best practices, but the rest of us live in the real world.

--

--

Amy Blankenship
Amy Blankenship

Written by Amy Blankenship

Full Stack developer at fintech company. I mainly write about React, Javascript, Typescript, and testing.

Responses (1)