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..268ea710 100644 --- a/src/splitInteger.test.js +++ b/src/splitInteger.test.js @@ -3,19 +3,28 @@ 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 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]); });