Skip to content

task solution - #1122

Open
OlegMysko wants to merge 2 commits into
mate-academy:mainfrom
OlegMysko:develop
Open

OlegMysko wants to merge 2 commits into
mate-academy:mainfrom
OlegMysko:develop

Conversation

@OlegMysko

Copy link
Copy Markdown

No description provided.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

Your solution requires changes before it can be approved. There are two critical issues:

  1. Missing required test cases: The test file doesn't include the four specific examples from the task description. You must add tests for splitInteger(8, 1) → [8], splitInteger(6, 2) → [3,3], splitInteger(17, 4) → [4,4,4,5], and splitInteger(32, 6) → [5,5,5,5,6,6].

  2. Syntax error in test file: There's a malformed comment /** /**3**/ that will cause a parse error. It should be /** to start a block comment properly.

Additionally, there's a console.log statement on line 22 of src/splitInteger.js that should be removed - this causes an ESLint violation and blocks test execution.


✨ 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 thread src/splitInteger.js Outdated
return parts;
}

console.log(splitInteger(1,5))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Debug statement should be removed from production code

Comment thread src/splitInteger.test.js
@@ -3,11 +3,31 @@
const splitInteger = require('./splitInteger');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This line has a syntax error - /** /**3**/ is malformed. It should be /** to start a block comment. This will cause a parse error when the file is loaded.

Comment thread src/splitInteger.test.js Outdated
Comment on lines +5 to +7
test(`should split a number into equal parts
if a value is divisible by a numberOfParts`, () => {});
if a value is divisible by a numberOfParts`, () => {
expect(splitInteger(4,2)).toEqual([2,2])

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This test uses splitInteger(4,2) expecting [2,2], but the task requires testing specific examples: splitInteger(8,1)→[8], splitInteger(6,2)→[3,3], splitInteger(17,4)→[4,4,4,5], splitInteger(32,6)→[5,5,5,5,6,6]. The tests should match these exact examples.

Comment thread src/splitInteger.test.js Outdated
Comment on lines +27 to +28
test('should sort parts ascending if they are not equal', () => {
expect(splitInteger(5,4)).toEqual([1,1,1,2])

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This test uses splitInteger(5,4) expecting [1,1,1,2], but the required examples are different. The task specifies splitInteger(17,4) should return [4,4,4,5].

Comment thread src/splitInteger.test.js Outdated
Comment on lines +31 to +32
test('should add zeros if value < numberOfParts', () => {
expect(splitInteger(1,4)).toEqual([0,0,0,1])

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This test expects [0,0,0,1] for splitInteger(1,4), but this behavior is not in the required examples. The task only specifies positive integers and the four examples above.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

Your solution is approved. The test file correctly implements all four required test cases from the task examples: (8,1), (6,2), (17,4), and (32,6). The implementation file has no syntax errors or ESLint violations, and all previous issues including the malformed comment syntax and console.log have been resolved. All core requirements are met - the function returns arrays with exactly the specified numberOfParts, the difference between max and min values is <= 1, and arrays are sorted in ascending order as required.


✨ 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