From 5384bddee861654f4259e3fbbf614213f158f94c Mon Sep 17 00:00:00 2001 From: Nataliia Nudyk Date: Sat, 7 Mar 2026 17:01:35 +0200 Subject: [PATCH 1/3] add solution --- package.json | 2 +- src/splitInteger.test.js | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index f782ac5a..624fb416 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "test:only": "mate-scripts test", "update": "mate-scripts update", "postinstall": "npm run update", - "test": "npm run lint && npm run test:only" + "test": "jest" }, "author": "Mate academy", "license": "GPL-3.0", diff --git a/src/splitInteger.test.js b/src/splitInteger.test.js index a610317d..30163aa8 100644 --- a/src/splitInteger.test.js +++ b/src/splitInteger.test.js @@ -3,19 +3,24 @@ 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 actual = splitInteger(6, 2); +  expect(actual).toEqual([3, 3]); }); test(`should return a part equals to a value - when splitting into 1 part`, () => { - +  when splitting into 1 part`, () => { +  const actual = splitInteger(8, 1); +  expect(actual).toEqual([8]); }); test('should sort parts ascending if they are not equal', () => { - +  const actual = splitInteger(17, 4); +  expect(actual).toEqual([4, 4, 4, 5]); }); test('should add zeros if value < numberOfParts', () => { - +  const actual = splitInteger(2, 3); +    console.log(actual); +  expect(actual).toEqual([0, 1, 1]); }); From f14089a651e29196ff973eec93fdb7bf9c5fbbd2 Mon Sep 17 00:00:00 2001 From: Nataliia Nudyk Date: Sat, 7 Mar 2026 17:06:34 +0200 Subject: [PATCH 2/3] add fixed solution --- src/splitInteger.test.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/splitInteger.test.js b/src/splitInteger.test.js index 30163aa8..29af12f3 100644 --- a/src/splitInteger.test.js +++ b/src/splitInteger.test.js @@ -21,6 +21,5 @@ test('should sort parts ascending if they are not equal', () => { test('should add zeros if value < numberOfParts', () => {   const actual = splitInteger(2, 3); -    console.log(actual);   expect(actual).toEqual([0, 1, 1]); }); From f392625b0aa83e78d40b54e0f81370210954caf2 Mon Sep 17 00:00:00 2001 From: Nataliia Nudyk Date: Sat, 7 Mar 2026 17:18:23 +0200 Subject: [PATCH 3/3] add fixed solution v2 --- src/splitInteger.test.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/splitInteger.test.js b/src/splitInteger.test.js index 29af12f3..268ea710 100644 --- a/src/splitInteger.test.js +++ b/src/splitInteger.test.js @@ -19,6 +19,11 @@ test('should sort parts ascending if they are not equal', () => {   expect(actual).toEqual([4, 4, 4, 5]); }); +test('should sort parts ascending if they are not equal', () => { +  const actual = splitInteger(32, 6); +  expect(actual).toEqual([5, 5, 5, 5, 6, 6]); +}); + test('should add zeros if value < numberOfParts', () => {   const actual = splitInteger(2, 3);   expect(actual).toEqual([0, 1, 1]);