Skip to content
Open
Show file tree
Hide file tree
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
32 changes: 16 additions & 16 deletions package-lock.json

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

16 changes: 12 additions & 4 deletions src/splitInteger.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@
const splitInteger = require('./splitInteger');

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(10, 2)).toEqual([5, 5]);
});

test(`should return a part equals to a value
when splitting into 1 part`, () => {});
when splitting into 1 part`, () => {
expect(splitInteger(8, 1)).toEqual([8]);
});

test('should sort parts ascending if they are not equal', () => {});
test('should sort parts ascending if they are not equal', () => {
expect(splitInteger(17, 4)).toEqual([4, 4, 4, 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.

Missing test case for splitInteger(6, 2) === [3, 3] from the required examples

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing test case for splitInteger(32, 6) === [5, 5, 5, 5, 6, 6] from the required examples


test('should add zeros if value < numberOfParts', () => {});
test('should add zeros if value < numberOfParts', () => {
expect(splitInteger(2, 3)).toEqual([0, 1, 1])
Comment on lines +19 to +20

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing semicolon at end of statement - this will cause a syntax error in strict mode

});
Loading