Skip to content

done#1016

Open
levchenko-dmytro wants to merge 1 commit into
mate-academy:mainfrom
levchenko-dmytro:developd
Open

done#1016
levchenko-dmytro wants to merge 1 commit into
mate-academy:mainfrom
levchenko-dmytro:developd

Conversation

@levchenko-dmytro
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@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

Decision: APPROVE

Your implementation and tests meet the core requirements. There are no critical blockers: the function behaves correctly, tests are valid, and the ESLint config is functional. Nice work keeping the algorithm simple, pure, and producing an ascending split with max–min ≤ 1.

Minor improvement (non-blocking): in .eslintrc.js, on the line where no-proto is disabled (likely near the rules section), prefer the named severity ("no-proto": "off") or add a short comment explaining why __proto__ usage is allowed. This makes intent clearer for future maintainers. Optionally, expand the test suite with a case like splitInteger(17, 4) -> [4,4,4,5] and a property-style test asserting length, integerness, and max - min <= 1 to strengthen coverage.

Overall, solid job—requirements are fully met.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

Comment thread .eslintrc.js
'no-proto': 0,
strict: 0,
'max-len': 0,
'no-proto': 0
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The configuration disables the no-proto rule using a numeric severity (0). Consider one of the following for clarity:

  • Use the named severity: "no-proto": "off" so it's immediately clear to readers, or
  • Add a brief comment explaining why you disabled this rule (e.g., legacy code relies on __proto__).

Either approach improves maintainability but is not required for functionality.

Copy link
Copy Markdown

@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

Decision: Requesting changes because key checklist requirements for tests are missing.

Critical issues to fix (blockers):

  • src/splitInteger.test.js: Missing required example test for splitInteger(17, 4) → must assert [4, 4, 4, 5] (task explicitly lists this example).
  • src/splitInteger.test.js: Lacks property-based assertions that the checklist requires across scenarios. Please add tests that verify for representative inputs:
    • length equals numberOfParts (e.g., expect(result).toHaveLength(numberOfParts)),
    • sum equals value (e.g., expect(result.reduce((a,b)=>a+b,0)).toBe(value)),
    • sorted ascending (check each result[i] <= result[i+1]),
    • max - min <= 1 (e.g., result[result.length - 1] - result[0] <= 1).
      Include at least: a divisible case, a non-divisible case, numberOfParts = 1, and value < numberOfParts (you can reuse your existing values and add these property checks to them).

Minor (non-blocking) improvements:

  • .eslintrc.js: Prefer 'no-proto': 'off' over 0, and add a short comment if disabling is intentional for readability.

Your implementation looks solid; once the missing example and property tests are added, this should meet the checklist. Keep the current example-based tests and supplement them with the property checks.


✨ 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 .eslintrc.js
'no-proto': 0,
strict: 0,
'max-len': 0,
'no-proto': 0
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Consider using the string form for the rule level for readability and adding a short justification comment if disabling no-proto is intentional. For example:

'no-proto': 'off' // disabled to allow use of __proto__ in test helpers / legacy interop

Using 'off' is clearer than 0 and helps future maintainers understand the intent.

Comment thread src/splitInteger.test.js
test(`should split a number into equal parts
if a value is divisible by a numberOfParts`, () => {

expect(splitInteger(6, 2)).toEqual([3, 3]);
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 asserting exact equality for splitInteger(6, 2) is fine for the example. In addition, add a property-based test (for divisible case) that checks: - the returned array has length numberOfParts, - the sum equals value, - array is sorted ascending, - max - min <= 1. That ensures the core constraints are validated independently of exact distribution.

Comment thread src/splitInteger.test.js
test(`should return a part equals to a value
when splitting into 1 part`, () => {

expect(splitInteger(8, 1)).toEqual([8]);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good: this test covers the numberOfParts = 1 case. Consider also adding a property test for this scenario that asserts length and sum explicitly (e.g., expect(result).toHaveLength(1); expect(result.reduce((a,b)=>a+b,0)).toBe(8);).

Comment thread src/splitInteger.test.js

test('should sort parts ascending if they are not equal', () => {

expect(splitInteger(32, 6)).toEqual([5, 5, 5, 5, 6, 6]);
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 example-based test for splitInteger(32, 6) is fine, but the task checklist requires a test for the example splitInteger(17, 4) which is missing. Add a test asserting splitInteger(17, 4) yields [4, 4, 4, 5]. Also add a non-divisible property-based test (could use 32,6 or 17,4) that checks length, sum, sorted order, and max - min <= 1 rather than relying only on exact equality.

Comment thread src/splitInteger.test.js

test('should add zeros if value < numberOfParts', () => {

expect(splitInteger(4, 6)).toEqual([0, 0, 1, 1, 1, 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 covers the value < numberOfParts case and asserts a concrete expected array. Also add a property-based test for this scenario verifying length and sum (and the max-min <= 1 constraint). That will satisfy checklist items requiring varied scenario coverage without over-constraining internal distributions.

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