Skip to content

Commit 0ab3198

Browse files
committed
Final solution
1 parent 473e15f commit 0ab3198

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

src/splitInteger.test.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,13 @@ test(`should split a number into equal parts
1111
test(`should return a part equals to a value
1212
when splitting into 1 part`, () => {
1313
expect(splitInteger(8, 1)).toEqual([8]);
14-
expect(splitInteger(25, 1)).toEqual([25]);
1514
});
1615

1716
test('should sort parts ascending if they are not equal', () => {
18-
const result = splitInteger(17, 4);
19-
const sorted = [...result].sort((a, b) => a - b);
20-
21-
expect(result).toEqual(sorted);
17+
expect(splitInteger(17, 4)).toEqual([4, 4, 4, 5]);
18+
expect(splitInteger(32, 6)).toEqual([5, 5, 5, 5, 6, 6]);
2219
});
2320

2421
test('should add zeros if value < numberOfParts', () => {
2522
expect(splitInteger(3, 5)).toEqual([0, 0, 1, 1, 1]);
26-
expect(splitInteger(1, 3)).toEqual([0, 0, 1]);
2723
});

0 commit comments

Comments
 (0)