Repository navigation
Conversation
hackertainment
left a comment
There was a problem hiding this comment.
The code looks good and you are almost there. Please keep it up :-)
Comment on lines
+25
to
+31
| test("should return 0 when character doesn't occur", () => { | ||
| const str = "salam"; | ||
| const char = "b"; | ||
|
|
||
| const count = countChar(str, char); | ||
| expect(count).toEqual(0); | ||
| }); No newline at end of file |
There was a problem hiding this comment.
There should be another valid boundary case that returns 0. Can you think of it? Please add it back. Thank you.
Comment on lines
+33
to
+42
| // Case 4: Numbers ending with "th" including the special case (11,12,13) | ||
| test(`Numbers ending with "th" including the special case (11,12,13)`, () => { | ||
| expect(getOrdinalNumber(10)).toEqual("10th"); | ||
| expect(getOrdinalNumber(11)).toEqual("11th"); | ||
| expect(getOrdinalNumber(12)).toEqual("12th"); | ||
| expect(getOrdinalNumber(13)).toEqual("13th"); | ||
| expect(getOrdinalNumber(14)).toEqual("14th"); | ||
| expect(getOrdinalNumber(5)).toEqual("5th"); | ||
| expect(getOrdinalNumber(4)).toEqual("4th"); | ||
| }); No newline at end of file |
There was a problem hiding this comment.
This test suite should include more test cases that is greater than 100 and still ended in th. Please add them back. Thank you.
There was a problem hiding this comment.
Your answers are correct. Just to give you a bit more thinking, besides const str = "hello"; , what special string should also be tested in each of the test suites?
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.
Self checklist
Task code
CYF-1060
Changelist
Practice TDD