From 62c0cf7de92f0120117e4e97dadefe6646b2b8c4 Mon Sep 17 00:00:00 2001 From: Nazarii-Lesniak Date: Tue, 2 Jun 2026 12:04:34 +0300 Subject: [PATCH 1/2] feat: create tests --- src/splitInteger.test.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/splitInteger.test.js b/src/splitInteger.test.js index 24003dd5..310a2069 100644 --- a/src/splitInteger.test.js +++ b/src/splitInteger.test.js @@ -3,11 +3,19 @@ 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(8, 1)).toEqual([8]); +}); -test('should sort parts ascending if they are not equal', () => {}); +test('should sort parts ascending if they are not equal', () => { + expect(splitInteger(17, 4)).toEqual([4, 4, 4, 5]); +}); -test('should add zeros if value < numberOfParts', () => {}); +test('should add zeros if value < numberOfParts', () => { + expect(splitInteger(32, 6)).toEqual([5, 5, 5, 5, 6, 6]); +}); From 3412e74a7541c870b30eedd5841bf9d8779cdaff Mon Sep 17 00:00:00 2001 From: Nazarii-Lesniak Date: Tue, 2 Jun 2026 12:11:01 +0300 Subject: [PATCH 2/2] fix: update the test to the test requirement --- 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 310a2069..e529abfa 100644 --- a/src/splitInteger.test.js +++ b/src/splitInteger.test.js @@ -17,5 +17,5 @@ test('should sort parts ascending if they are not equal', () => { }); test('should add zeros if value < numberOfParts', () => { - expect(splitInteger(32, 6)).toEqual([5, 5, 5, 5, 6, 6]); + expect(splitInteger(2, 6)).toEqual([0, 0, 0, 0, 1, 1]); });