From 90c62d8da6cd04fa50053bb576e565c9bc3f4655 Mon Sep 17 00:00:00 2001 From: Yurii Kumpanenko Date: Fri, 1 May 2026 15:48:29 +0300 Subject: [PATCH 1/2] add task solution --- src/splitInteger.test.js | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/splitInteger.test.js b/src/splitInteger.test.js index 24003dd5..14e3378e 100644 --- a/src/splitInteger.test.js +++ b/src/splitInteger.test.js @@ -3,11 +3,27 @@ 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`, () => { + const result = splitInteger(16, 4); + + expect(result).toEqual([4, 4, 4, 4]); +}); test(`should return a part equals to a value - when splitting into 1 part`, () => {}); + when splitting into 1 part`, () => { + const result = splitInteger(16, 1); + + expect(result).toEqual([16]); +}); + +test('should sort parts ascending if they are not equal', () => { + const result = splitInteger(17, 4); + + expect(result).toEqual([4, 4, 4, 5]); +}); -test('should sort parts ascending if they are not equal', () => {}); +test('should add zeros if value < numberOfParts', () => { + const result = splitInteger(3, 4); -test('should add zeros if value < numberOfParts', () => {}); + expect(result).toEqual([0, 1, 1, 1]); +}); From 3e098398b77ea48d09add8d3285b7daa5e771358 Mon Sep 17 00:00:00 2001 From: Yurii Kumpanenko Date: Fri, 1 May 2026 16:03:20 +0300 Subject: [PATCH 2/2] fix something --- src/splitInteger.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/splitInteger.test.js b/src/splitInteger.test.js index 14e3378e..04adc262 100644 --- a/src/splitInteger.test.js +++ b/src/splitInteger.test.js @@ -23,7 +23,7 @@ test('should sort parts ascending if they are not equal', () => { }); test('should add zeros if value < numberOfParts', () => { - const result = splitInteger(3, 4); + const result = splitInteger(4, 8); - expect(result).toEqual([0, 1, 1, 1]); + expect(result).toEqual([0, 0, 0, 0, 1, 1, 1, 1]); });