From 392b41d1036e8db17388d8f4df9664f326e3152a Mon Sep 17 00:00:00 2001 From: Olha Lishenko Date: Sun, 22 Feb 2026 12:20:55 +0200 Subject: [PATCH 1/2] implement task solution --- src/splitInteger.test.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/splitInteger.test.js b/src/splitInteger.test.js index a610317d..5f1f5e8a 100644 --- a/src/splitInteger.test.js +++ b/src/splitInteger.test.js @@ -4,18 +4,27 @@ const splitInteger = require('./splitInteger'); test(`should split a number into equal parts if a value is divisible by a numberOfParts`, () => { + const result = splitInteger(6, 2); + expect(result).toEqual([3, 3]); }); test(`should return a part equals to a value when splitting into 1 part`, () => { + const result = splitInteger(8, 1); + expect(result).toEqual([8]); }); test('should sort parts ascending if they are not equal', () => { + const result = splitInteger(17, 4); + const unique = new Set(result); + expect([...unique][1]).toBeGreaterThan([...unique][0]); }); test('should add zeros if value < numberOfParts', () => { + const result = splitInteger(2, 4); + expect(result).toEqual([0, 0, 1, 1]); }); From dc991b5df8b29628f4027b470506e997d9181f24 Mon Sep 17 00:00:00 2001 From: Olha Lishenko Date: Sun, 22 Feb 2026 12:29:55 +0200 Subject: [PATCH 2/2] fix third test --- src/splitInteger.test.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/splitInteger.test.js b/src/splitInteger.test.js index 5f1f5e8a..d7eebd60 100644 --- a/src/splitInteger.test.js +++ b/src/splitInteger.test.js @@ -18,9 +18,8 @@ test(`should return a part equals to a value test('should sort parts ascending if they are not equal', () => { const result = splitInteger(17, 4); - const unique = new Set(result); - expect([...unique][1]).toBeGreaterThan([...unique][0]); + expect(result).toEqual([4, 4, 4, 5]); }); test('should add zeros if value < numberOfParts', () => {