@@ -4,6 +4,7 @@ const splitInteger = require('./splitInteger');
44
55test ( `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
1920test ( '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
2526test ( '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