London | ITP-Jan-26 | Alexandru Pocovnicu | Sprint 3 | Practice TDD#987
Open
alexandru-pocovnicu wants to merge 8 commits intoCodeYourFuture:mainfrom
Open
Conversation
…d negative numbers
…, with error handling for negative counts
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
4 similar comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
cjyuan
reviewed
Feb 25, 2026
Comment on lines
+3
to
+4
| let numberLastDigit = numberToString[numberToString.length - 1]; | ||
| let numberLast2Digits = numberToString.slice(numberToString.length - 2); |
Contributor
There was a problem hiding this comment.
.slice(-N) is clear enough to indicate it extract the last N characters from a string, regardless of string length.
Comment on lines
+23
to
+34
| test("should repeat string count times", () => { | ||
| const str = "bye"; | ||
| const count = 1; | ||
| const repeatedStr = repeatStr(str, count); | ||
| expect(repeatedStr).toEqual("bye"); | ||
| }); | ||
|
|
||
| // Case: Handle count of 0: | ||
| // Given a target string `str` and a `count` equal to 0, | ||
| // When the repeatStr function is called with these inputs, | ||
| // Then it should return an empty string. | ||
| test("should repeat string count times", () => { |
Contributor
There was a problem hiding this comment.
Can you revise these test descriptions to make the failure messages more informative, so it's immediately clear both what caused the test to fail and what the expected outcome was?
Comment on lines
+43
to
+48
| test("should append 'th' for numbers ending with any number including 11,12 or 13, except those ending with 1,2 or 3", () => { | ||
| expect(getOrdinalNumber(12)).toEqual("12th"); | ||
| expect(getOrdinalNumber(25)).toEqual("25th"); | ||
| expect(getOrdinalNumber(111)).toEqual("111th"); | ||
| expect(getOrdinalNumber(4)).toEqual("4th"); | ||
| }); |
Contributor
There was a problem hiding this comment.
Can you add more test cases to this group to make the coverage more comprehensive?
If the number of cases becomes too large, you can consider organizing them into meaningful subcategories.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Learners, PR Template
Self checklist
Changelist
Completed all exercises from practice tdd