From 591b60f8baa1d91211cc7c46150f5604effa47b3 Mon Sep 17 00:00:00 2001 From: Yurii_Popovskiy Date: Thu, 15 May 2025 11:24:48 +0300 Subject: [PATCH 1/3] AddSomeTest --- src/splitInteger.test.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/splitInteger.test.js b/src/splitInteger.test.js index a610317d..55522da0 100644 --- a/src/splitInteger.test.js +++ b/src/splitInteger.test.js @@ -3,19 +3,30 @@ 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]); + expect(splitInteger(10, 5)).toEqual([2, 2, 2, 2, 2]); + expect(splitInteger(100, 10)).toEqual([10, 10, 10, 10, 10, 10, 10, 10, 10, 10]); }); 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]); + expect(splitInteger(100, 1)).toEqual([100]); }); test('should sort parts ascending if they are not equal', () => { - + expect(splitInteger(17, 4)).toEqual([4, 4, 4, 5]); + expect(splitInteger(32, 6)).toEqual([5, 5, 5, 5, 6, 6]); + expect(splitInteger(7, 3)).toEqual([2, 2, 3]); }); test('should add zeros if value < numberOfParts', () => { + expect(splitInteger(3, 5)).toEqual([0, 0, 1, 1, 1]); + + expect(splitInteger(0, 2)).toEqual([0, 0]); + expect(splitInteger(5, 10)).toEqual([0, 0, 0, 0, 0, 1, 1, 1, 1, 1]); }); From d609cd0205d080be3f48d85a07cda0a13a0ebf86 Mon Sep 17 00:00:00 2001 From: Yurii_Popovskiy Date: Thu, 15 May 2025 11:44:24 +0300 Subject: [PATCH 2/3] addSomeChanges --- src/splitInteger.test.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/splitInteger.test.js b/src/splitInteger.test.js index 55522da0..ea2e9179 100644 --- a/src/splitInteger.test.js +++ b/src/splitInteger.test.js @@ -7,7 +7,9 @@ test(`should split a number into equal parts if a value is divisible by a numberOfParts`, () => { expect(splitInteger(6, 2)).toEqual([3, 3]); expect(splitInteger(10, 5)).toEqual([2, 2, 2, 2, 2]); - expect(splitInteger(100, 10)).toEqual([10, 10, 10, 10, 10, 10, 10, 10, 10, 10]); + + expect(splitInteger(100, 10)).toEqual([10, 10, 10, 10, 10, + 10, 10, 10, 10, 10]); }); test(`should return a part equals to a value From 9b7212e7967a6a8b439b3857249cd053f2734ddd Mon Sep 17 00:00:00 2001 From: Yurii_Popovskiy Date: Thu, 15 May 2025 11:57:56 +0300 Subject: [PATCH 3/3] finalChabges --- src/splitInteger.test.js | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/splitInteger.test.js b/src/splitInteger.test.js index ea2e9179..7af160d5 100644 --- a/src/splitInteger.test.js +++ b/src/splitInteger.test.js @@ -6,29 +6,19 @@ test(`should split a number into equal parts if a value is divisible by a numberOfParts`, () => { expect(splitInteger(6, 2)).toEqual([3, 3]); - expect(splitInteger(10, 5)).toEqual([2, 2, 2, 2, 2]); - - expect(splitInteger(100, 10)).toEqual([10, 10, 10, 10, 10, - 10, 10, 10, 10, 10]); }); test(`should return a part equals to a value when splitting into 1 part`, () => { expect(splitInteger(8, 1)).toEqual([8]); - expect(splitInteger(100, 1)).toEqual([100]); }); test('should sort parts ascending if they are not equal', () => { expect(splitInteger(17, 4)).toEqual([4, 4, 4, 5]); - expect(splitInteger(32, 6)).toEqual([5, 5, 5, 5, 6, 6]); - expect(splitInteger(7, 3)).toEqual([2, 2, 3]); }); test('should add zeros if value < numberOfParts', () => { expect(splitInteger(3, 5)).toEqual([0, 0, 1, 1, 1]); - expect(splitInteger(0, 2)).toEqual([0, 0]); - - expect(splitInteger(5, 10)).toEqual([0, 0, 0, 0, 0, 1, 1, 1, 1, 1]); });