Skip to content

Add task solution#1059

Open
Igrik74 wants to merge 2 commits intomate-academy:mainfrom
Igrik74:develop
Open

Add task solution#1059
Igrik74 wants to merge 2 commits intomate-academy:mainfrom
Igrik74:develop

Conversation

@Igrik74
Copy link

@Igrik74 Igrik74 commented Jan 26, 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

This requires a few changes as a key test case doesn't correctly validate the function's output. You've done a great job setting up the test suite and covering several scenarios, but there's a critical issue in your test for splitInteger(17, 4).

Currently, the test only verifies that the output array is sorted, but it doesn't check if the values themselves are correct. This means an incorrect implementation returning a sorted array like [1, 2, 3, 11] would still pass. To fix this, you should assert against the exact expected output:

expect(splitInteger(17, 4)).toEqual([4, 4, 4, 5]);

This single assertion validates the values, their order, and the array length all at once. Also, please add the missing test case for splitInteger(32, 6) from the task description to ensure full coverage. These changes will make your tests much more reliable!


✨ 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

Comment on lines 18 to 21
const result = splitInteger(17, 4);
const sorted = [...result].sort((a, b) => a - b);

expect(result).toEqual(sorted);

Choose a reason for hiding this comment

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

This test correctly verifies that the output array is sorted, but it doesn't check if the function produced the correct parts. For example, if the function returned [1, 2, 3, 11] for this input, the test would still pass. A more robust approach is to assert against the expected output directly: expect(splitInteger(17, 4)).toEqual([4, 4, 4, 5]);. This validates the values, sorting, and length all at once. Consider adding a test case for splitInteger(32, 6) from the description as well.

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 on this revision! I'm happy to approve your solution. You've successfully addressed all the previous feedback by correcting the test cases to validate against the exact expected arrays. It's also great to see you've added the missing test for splitInteger(32, 6). Your test suite is now robust and fully covers all the requirements. Well done!


✨ 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