Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #788

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
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
14 changes: 6 additions & 8 deletions src/splitInteger.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@ const splitInteger = require('./splitInteger');

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

});

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

expect(splitInteger(17, 4))
.toHaveLength(4);
Comment on lines +7 to +8

Choose a reason for hiding this comment

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

The test case for splitInteger(17, 4) should expect the result [4, 4, 4, 5] according to the task description, not just the length of 4. Consider updating the expectation to check for the correct array content.

});

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

expect(splitInteger(32, 6))
.toEqual([5, 5, 5, 5, 6, 6]);
});

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

expect(splitInteger(17, 0))
.toEqual([]);
Comment on lines +17 to +18

Choose a reason for hiding this comment

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

The test case for splitInteger(17, 0) is incorrect. According to the task description, the function should return an array with exactly numberOfParts elements. Since numberOfParts is 0, this test case is invalid as per the task requirements.

});