Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Great start on the tests for ifElse! You've correctly covered the main conditional branches. However, a few changes are needed to make your tests more robust and meet all the requirements. The main issue is that the tests don't verify that the callbacks are executed with no arguments. Please add assertions like expect(first).toHaveBeenCalledWith(); to your first test, and similar checks for condition() and second() in the other test. Additionally, please add an assertion in your second test to ensure the function returns undefined, just as you did in the first one. With these additions, your tests will be perfect!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
|
|
||
| expect(condition).toHaveBeenCalledTimes(1); | ||
| expect(condition).toHaveBeenCalledWith(); | ||
| expect(first).toHaveBeenCalledTimes(1); |
There was a problem hiding this comment.
Good check. To fully meet the requirements, please also add an assertion that first was called with no arguments, like expect(first).toHaveBeenCalledWith();.
|
|
||
| expect(condition).toHaveBeenCalledTimes(1); | ||
| expect(first).not.toHaveBeenCalled(); | ||
| expect(second).toHaveBeenCalledTimes(1); |
There was a problem hiding this comment.
This test case is less complete than the first one. Please also add assertions to check that condition and second are called with no arguments, and that ifElse returns undefined to fully cover the requirements.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Great work on this! You've correctly addressed the feedback about checking for an undefined return value. This requires changes because one of the requirements is not fully tested. In your second test case ('calls second when condition returns false'), you need to add assertions to verify that both the condition and second callbacks were called with no arguments. You can do this by adding expect(condition).toHaveBeenCalledWith(); and expect(second).toHaveBeenCalledWith();, just like you did in the first test. Once you add these checks, your tests will fully cover all the requirements.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
|
|
||
| expect(condition).toHaveBeenCalledTimes(1); | ||
| expect(first).not.toHaveBeenCalled(); | ||
| expect(second).toHaveBeenCalledTimes(1); |
There was a problem hiding this comment.
This test is almost complete. According to the requirements, you also need to verify that both the condition and second callbacks were called with no arguments. You can add assertions using toHaveBeenCalledWith() for both mocks.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Excellent work! You've successfully addressed the feedback from the previous review by adding the necessary assertions to your second test case. Your tests now fully cover all the requirements for the ifElse function. This is a great example of iterating on feedback to produce a solid solution. I am happy to approve your submission, keep up the fantastic work!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.