Try to avoid testing implementation details, it’s better to focus on testing functionality.
In you case I would test result in UI, rather than “get item” function. In that case, you can make refactoring, change name of the function, transfer to different module, and tests will help you to validate that you didn’t break functionality of the code.
Then you testing implantation, you need to change your tests with your code, so it’s not very helpful.
Try to avoid testing implementation details, it’s better to focus on testing functionality.
In you case I would test result in UI, rather than “get item” function. In that case, you can make refactoring, change name of the function, transfer to different module, and tests will help you to validate that you didn’t break functionality of the code.
Then you testing implantation, you need to change your tests with your code, so it’s not very helpful.
Thanks for your reply!
I am still a beginner of testing and I found that it is hard to learn how to write good tests. You reply is extremely helpful. Thanks! :)