Repository navigation
London | 26-ITP-Sep | Chandramani Gaire | Sprint 2 | Practice tdd - #1738
gaireprakash20-ops wants to merge 9 commits into
Conversation
…ces and no occurrences of a character in a string
hackertainment
left a comment
There was a problem hiding this comment.
Thank you for your coursework. 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 where the char to count exists in the whole string str. How about other general cases?
There was a problem hiding this comment.
Make different general cases like hello abc xyz
| test("should return 0 when there is not repeated char in str", () => { | ||
| const str = "hello"; | ||
| const char = "a"; | ||
| const count = countChar(str, char); | ||
| expect(count).toEqual(0); | ||
| }); |
There was a problem hiding this comment.
This test case is correct. However, there is a special str which would give 0 anyway. Can you think of it? If so, please add it as well. Thank you.
There was a problem hiding this comment.
make a two special cases like case sensitive example str = Apple and Char = a and empty string
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?
|
The fixes looked good. How about #1738 (comment) ? |
Learners, PR Template
Self checklist
Task code
CYF-1060
Changelist
I have completed the exercise as per the instructions provided.