Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
17 changes: 11 additions & 6 deletions src/splitInteger.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This console.log appears to be for debugging. It's best practice to remove such statements from the final version of your tests.

  expect(actual).toEqual([0, 1, 1]);
});