Skip to content

Solution#243

Open
Vall-Re wants to merge 3 commits intomate-academy:masterfrom
Vall-Re:develop
Open

Solution#243
Vall-Re wants to merge 3 commits intomate-academy:masterfrom
Vall-Re:develop

Conversation

@Vall-Re
Copy link

@Vall-Re Vall-Re commented Feb 27, 2026

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example


expect(condition).toHaveBeenCalledTimes(1);
expect(condition).toHaveBeenCalledWith();
expect(first).toHaveBeenCalledTimes(1);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example


expect(condition).toHaveBeenCalledTimes(1);
expect(first).not.toHaveBeenCalled();
expect(second).toHaveBeenCalledTimes(1);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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! ✨

Footnotes

  1. Rate AI review example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants