We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 883bf21 commit ceed115Copy full SHA for ceed115
1 file changed
src/splitInteger.test.js
@@ -4,18 +4,23 @@ const splitInteger = require('./splitInteger');
4
5
test(`should split a number into equal parts
6
if a value is divisible by a numberOfParts`, () => {
7
-
+ expect(splitInteger(10, 5)).toEqual([2, 2, 2, 2, 2]);
8
+ expect(splitInteger(12, 4)).toEqual([3, 3, 3, 3]);
9
});
10
11
test(`should return a part equals to a value
12
when splitting into 1 part`, () => {
13
+ expect(splitInteger(7, 1)).toEqual([7]);
14
+ expect(splitInteger(100, 1)).toEqual([100]);
15
16
17
test('should sort parts ascending if they are not equal', () => {
18
+ expect(splitInteger(17, 4)).toEqual([4, 4, 4, 5]);
19
+ expect(splitInteger(32, 6)).toEqual([5, 5, 5, 5, 6, 6]);
20
+ expect(splitInteger(10, 3)).toEqual([3, 3, 4]);
21
22
23
test('should add zeros if value < numberOfParts', () => {
24
+ expect(splitInteger(3, 5)).toEqual([0, 0, 1, 1, 1]);
25
+ expect(splitInteger(2, 4)).toEqual([0, 0, 1, 1]);
26
0 commit comments