Repository navigation
Conversation
hackertainment
left a comment
There was a problem hiding this comment.
Thank you for your coursework. Keep it up.
Comment on lines
21
to
+39
| // Scenario: No Occurrences | ||
| // Given the input string `str`, | ||
| // And a character `char` that does not exist within `str`. | ||
| // When the function is called with these inputs, | ||
| // Then it should return 0, indicating that no occurrences of `char` were found. | ||
|
|
||
| test("should count multiple occurrences of a character", () => { | ||
| const str = "aaaaa"; | ||
| const char = "z"; | ||
| const count = countChar(str, char); | ||
| expect(count).toEqual(0); | ||
| }); | ||
|
|
||
| test("should count multiple occurrences of a character", () => { | ||
| const str = "aaaaa"; | ||
| const char = "7"; | ||
| const count = countChar(str, char); | ||
| expect(count).toEqual(0); | ||
| }); |
There was a problem hiding this comment.
These two test case are similar. However, there is a special str which also gives 0. Can you think of it? If so, please add it as well. Thank you.
Comment on lines
+34
to
+38
| test("should append 'th' for numbers ending with 4, except those ending with 0", () => { | ||
| expect(getOrdinalNumber(4)).toEqual("4th"); | ||
| expect(getOrdinalNumber(144)).toEqual("144th"); | ||
| expect(getOrdinalNumber(40)).toEqual("40th"); | ||
| }); |
There was a problem hiding this comment.
There should be more test cases related to lines 4-6 of your program. Please add them into this test suite. Thank you.
There was a problem hiding this comment.
Your test cases are correct. Just for you to think a little bit more, besides const str = "hello", what special string should also be added to each of the test cases?
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.
Task code
CYF-1060
Changelist
Updated files in question