From c8cf38f7968a3568604db51eb582068d2296a984 Mon Sep 17 00:00:00 2001 From: Andrew Lyalkov Date: Sat, 16 Nov 2024 12:47:28 +0200 Subject: [PATCH 1/2] solution --- src/splitInteger.test.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/splitInteger.test.js b/src/splitInteger.test.js index a610317d..0f296763 100644 --- a/src/splitInteger.test.js +++ b/src/splitInteger.test.js @@ -4,18 +4,22 @@ const splitInteger = require('./splitInteger'); test(`should split a number into equal parts if a value is divisible by a numberOfParts`, () => { - + expect(splitInteger(10, 2)) + .toBe(5, 5); }); test(`should return a part equals to a value when splitting into 1 part`, () => { - + expect(splitInteger(10, 1)) + .toBe(10); }); test('should sort parts ascending if they are not equal', () => { - + expect(splitInteger(11, 2)) + .toBe(5, 6); }); test('should add zeros if value < numberOfParts', () => { - + expect(splitInteger(1, 2)) + .toBe(0.5, 0.5); }); From 947d6c174e9af96d4630b3a7f05ae84ab1d7eb5b Mon Sep 17 00:00:00 2001 From: Andrew Lyalkov Date: Sun, 17 Nov 2024 13:51:47 +0200 Subject: [PATCH 2/2] Solution --- src/splitInteger.test.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/splitInteger.test.js b/src/splitInteger.test.js index 0f296763..e21a7dfe 100644 --- a/src/splitInteger.test.js +++ b/src/splitInteger.test.js @@ -5,21 +5,21 @@ const splitInteger = require('./splitInteger'); test(`should split a number into equal parts if a value is divisible by a numberOfParts`, () => { expect(splitInteger(10, 2)) - .toBe(5, 5); + .toEqual([5, 5]); }); test(`should return a part equals to a value when splitting into 1 part`, () => { expect(splitInteger(10, 1)) - .toBe(10); + .toEqual([10]); }); test('should sort parts ascending if they are not equal', () => { expect(splitInteger(11, 2)) - .toBe(5, 6); + .toEqual([5, 6]); }); test('should add zeros if value < numberOfParts', () => { expect(splitInteger(1, 2)) - .toBe(0.5, 0.5); + .toEqual([0, 1]); });