From d5e992cf019ecc929dc614d0fb5af1faafe5208f Mon Sep 17 00:00:00 2001 From: Pavlo Date: Sun, 30 Aug 2026 21:08:30 +0300 Subject: [PATCH 1/3] add task solution --- src/splitInteger.test.js | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/splitInteger.test.js b/src/splitInteger.test.js index 24003dd5..a2b09af7 100644 --- a/src/splitInteger.test.js +++ b/src/splitInteger.test.js @@ -3,11 +3,28 @@ 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(6, 2)).toEqual([3, 3]); +}); test(`should return a part equals to a value - when splitting into 1 part`, () => {}); + when splitting into 1 part`, () => { + expect(splitInteger(3, 1)).toEqual([3]); +}); -test('should sort parts ascending if they are not equal', () => {}); +test('should sort parts ascending if they are not equal', () => { + expect(splitInteger(3, 2)).toEqual([1, 3]); +}); -test('should add zeros if value < numberOfParts', () => {}); +test('should add zeros if value < numberOfParts', () => { + expect(splitInteger(1, 3)).toEqual([0, 0, 1]); +}); + +test(`should split integer when value + is not divisible by numberOfParts`, () => { + expect(splitInteger(17, 4)).toEqual([4, 4, 4, 5]); +}); + +test('should distribute values evenly with difference <= 1', () => { + expect(splitInteger(32, 6)).toEqual([5, 5, 5, 5, 6, 6]); +}); From 97b2597335a1485c8ae77c16b8896c575344ee65 Mon Sep 17 00:00:00 2001 From: Pavlo Date: Sun, 30 Aug 2026 21:13:06 +0300 Subject: [PATCH 2/3] add task solution 2 --- src/splitInteger.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/splitInteger.test.js b/src/splitInteger.test.js index a2b09af7..18442d58 100644 --- a/src/splitInteger.test.js +++ b/src/splitInteger.test.js @@ -13,7 +13,7 @@ test(`should return a part equals to a value }); test('should sort parts ascending if they are not equal', () => { - expect(splitInteger(3, 2)).toEqual([1, 3]); + expect(splitInteger(3, 2)).toEqual([2, 3]); }); test('should add zeros if value < numberOfParts', () => { From 1cf8c3e04154d2f50402f871176e3408a94aff30 Mon Sep 17 00:00:00 2001 From: Pavlo Date: Sun, 30 Aug 2026 21:23:46 +0300 Subject: [PATCH 3/3] add task solution 3 --- src/splitInteger.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/splitInteger.test.js b/src/splitInteger.test.js index 18442d58..dded95c7 100644 --- a/src/splitInteger.test.js +++ b/src/splitInteger.test.js @@ -13,7 +13,7 @@ test(`should return a part equals to a value }); test('should sort parts ascending if they are not equal', () => { - expect(splitInteger(3, 2)).toEqual([2, 3]); + expect(splitInteger(3, 2)).toEqual([1, 2]); }); test('should add zeros if value < numberOfParts', () => {