-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Develop #1048
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Develop #1048
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,17 +5,30 @@ const splitInteger = require('./splitInteger'); | |
| test(`should split a number into equal parts | ||
| if a value is divisible by a numberOfParts`, () => { | ||
|
|
||
| const result = splitInteger(8, 1); | ||
|
|
||
| expect(result).toEqual([8]); | ||
| }); | ||
|
|
||
| test(`should return a part equals to a value | ||
| when splitting into 1 part`, () => { | ||
|
Comment on lines
13
to
14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This description would be perfect for a test case like |
||
|
|
||
| const result = splitInteger(6, 2); | ||
|
|
||
| expect(result).toEqual([3, 3]); | ||
| }); | ||
|
|
||
| test('should sort parts ascending if they are not equal', () => { | ||
|
|
||
| const result = splitInteger(17, 4); | ||
|
|
||
| expect(result).toEqual([4, 4, 4, 5]); | ||
| expect(result).toEqual(result.slice().sort((a, b) => a - b)); | ||
| }); | ||
|
|
||
| test('should add zeros if value < numberOfParts', () => { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This description is misleading. For the test case |
||
|
|
||
| const result = splitInteger(32, 6); | ||
|
|
||
| expect(result).toEqual([5, 5, 5, 5, 6, 6]); | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This description seems to have been swapped with the next test's description. This test case,
splitInteger(8, 1), is about splitting into a single part, which is what the description for the second test mentions.