Skip to content
Open
Changes from all commits
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
53 changes: 37 additions & 16 deletions src/splitInteger.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,41 @@

const splitInteger = require('./splitInteger');

test(`should split a number into equal parts
if a value is divisible by a numberOfParts`, () => {

});

test(`should return a part equals to a value
when splitting into 1 part`, () => {

});

test('should sort parts ascending if they are not equal', () => {

});

test('should add zeros if value < numberOfParts', () => {

const testCases = [
{
description: 'should split a number into equal parts if a value is divisible by a numberOfParts',

Check failure on line 7 in src/splitInteger.test.js

View workflow job for this annotation

GitHub Actions / build (12.x)

Line 7 exceeds the maximum line length of 80
value: 6,
numberOfParts: 2,
expected: [3, 3],
},
{
description: 'should return a part equals to a value when splitting into 1 part',

Check failure on line 13 in src/splitInteger.test.js

View workflow job for this annotation

GitHub Actions / build (12.x)

Line 13 exceeds the maximum line length of 80
value: 8,
numberOfParts: 1,
expected: [8],
},
{
description: 'should sort parts ascending if they are not equal',
value: 17,
numberOfParts: 4,
expected: [4, 4, 4, 5],
},
{
description: 'should sort parts ascending if they are not equal',
value: 32,
numberOfParts: 6,
expected: [5, 5, 5, 5, 6, 6],
},
{
description: 'should add zeros if value < numberOfParts',
value: 2,
numberOfParts: 5,
expected: [0, 0, 0, 1, 1],
},
];

testCases.forEach(({ description, value, numberOfParts, expected }) => {
test(description, () => {
expect(splitInteger(value, numberOfParts)).toEqual(expected);
})
});
Loading