Repository navigation
Cape Town | 26-ITP-Sep | Quentin Gwele | Sprint 2 | coursework/practice-TDD - #1688
lwandogwele52-ui wants to merge 4 commits into
Conversation
hackertainment
left a comment
There was a problem hiding this comment.
The code generally looks good to me. Please keep it up.
| test("should count multiple occurrences of a character", () => { | ||
| const str = "aaaaa"; | ||
| const char = "a"; | ||
| const count = countChar(str, char); | ||
| expect(count).toEqual(5); | ||
| }); |
There was a problem hiding this comment.
This is a special case of str where it is all the char to count. Would it still count correctly if the char just exists in some part of the str?
| test("should return 0 when the character does not occur in the string", () => { | ||
| const str = "hello"; | ||
| const char = "z"; | ||
| const count = countChar(str, char); | ||
| expect(count).toEqual(0); | ||
| }); |
There was a problem hiding this comment.
There is a special str that would give 0 anyway. Please add that test case as well. 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 PR has not been completed, as I didn't see test cases have been added regarding the following comments:
Can you check whether your updates has been staged and committed? Thanks a lot. |
Learners, PR Template
Self checklist
Task code
CYF-1060
Changelist
Finished all files.