Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"eslint": "^5.16.0",
"eslint-plugin-jest": "^22.4.1",
"eslint-plugin-node": "^8.0.1",
"jest": "^24.5.0"
"jest": "^24.9.0"
},
"mateAcademy": {
"projectType": "javascript"
Expand Down
8 changes: 4 additions & 4 deletions src/splitInteger.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ const splitInteger = require('./splitInteger');

test(`should split a number into equal parts
if a value is divisible by a numberOfParts`, () => {

expect(splitInteger(12, 3)).toEqual([4, 4, 4]);
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 is a valid test, but the task description requires a test for splitInteger(6, 2). It's important to verify the exact examples provided in the requirements.

});

test(`should return a part equals to a value
when splitting into 1 part`, () => {

expect(splitInteger(12, 1)).toEqual([12]);
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 is another valid test case, but the requirements specify testing splitInteger(8, 1). Please make sure all provided examples are covered.

});

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

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

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

expect(splitInteger(3, 5)).toEqual([0, 0, 1, 1, 1]);
});
Comment on lines +19 to 21
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You're almost there! The task description requires one more specific example to be tested: splitInteger(32, 6). Please add a new test case for this scenario to ensure the function is fully validated against the requirements.