Closed lindjacob closed 2 weeks ago
I have mocked the hand function. It works by intercepting the return value and substituting it with a constant that I have decided. I tested the hand class as it was the only thing object with a return value that we can test with a mock.
No, mocks are not relevant for this code, because there is nothing to really isolate. When using mocks, we are isolating a logic from its dependencies that would otherwise slow down or maybe "break" our tests without anything being wrong with our code. Using mock tests generally lowers our confidence in our tests as anything mocked is not actually testing a real scenario. Integration tests would be better here.
Here's a piece of wisdom that a GPT came up with. I asked it the following prompt:
Here are a few arguments:
Add a unit test to the project that uses mocks
Commit your unit test mock to the repository. In the comments of this issue put a few words on what goes on in the using test, why did you go with exactly this example.
Are mocks relevant in something as simple at this code base? Argue Why? or Why not?