Skip to content

Commit 3d2b461

Browse files
author
melarkkkk
committed
feat: add additional cases to the existing tests
1 parent 9663c72 commit 3d2b461

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/splitInteger.test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const splitInteger = require('./splitInteger');
44

55
test(`should split a number into equal parts
66
if a value is divisible by a numberOfParts`, () => {
7+
expect(splitInteger(6, 2)).toEqual([3, 3]);
78
expect(splitInteger(8, 1)).toEqual([8]);
89
expect(splitInteger(8, 2)).toEqual([4, 4]);
910
expect(splitInteger(8, 4)).toEqual([2, 2, 2, 2]);
@@ -18,12 +19,13 @@ test(`should return a part equals to a value
1819

1920
test('should sort parts ascending if they are not equal', () => {
2021
expect(splitInteger(8, 5)).toEqual([1, 1, 2, 2, 2]);
21-
expect(splitInteger(5, 2)).toEqual([2, 3]);
22-
expect(splitInteger(10, 3)).toEqual([3, 3, 4]);
22+
expect(splitInteger(17, 4)).toEqual([4, 4, 4, 5]);
23+
expect(splitInteger(32, 6)).toEqual([5, 5, 5, 5, 6, 6]);
2324
});
2425

2526
test('should add zeros if value < numberOfParts', () => {
2627
expect(splitInteger(2, 5)).toEqual([0, 0, 0, 1, 1]);
2728
expect(splitInteger(1, 2)).toEqual([0, 1]);
2829
expect(splitInteger(3, 4)).toEqual([0, 1, 1, 1]);
2930
});
31+

0 commit comments

Comments
 (0)