Repository navigation
London | 26-ITP-Sep | Mahir Shah | Sprint 2 | Practice TDD - #1696
Open
MahirShah300 wants to merge 11 commits into
Open
MahirShah300 wants to merge 11 commits into
MahirShah300 wants to merge 11 commits into
Conversation
hackertainment
left a comment
There was a problem hiding this comment.
The code generally looks good to me. Keep it up.
Comment on lines
13
to
+32
| test("should count multiple occurrences of a character", () => { | ||
| const str = "aaaaa"; | ||
| const char = "a"; | ||
| const count = countChar(str, char); | ||
| expect(count).toEqual(5); | ||
| }); | ||
|
|
||
| test("should count multiple occurrences of a character when mixed with other characters", () => { | ||
| const str = "ababa"; | ||
| const char = "a"; | ||
| const count = countChar(str, char); | ||
| expect(count).toEqual(3); | ||
| }); | ||
|
|
||
| test("should count multiple occurrences of a character at the beginning and end of a string", () => { | ||
| const str = "abbba"; | ||
| const char = "a"; | ||
| const count = countChar(str, char); | ||
| expect(count).toEqual(2); | ||
| }); |
There was a problem hiding this comment.
The 3 cases are all testing str which both starts and ends with the char. Would the program still work correctly if char just exists in the middle part of str?
Comment on lines
+39
to
+44
| test("Should count 0 occurrences of a character", () => { | ||
| const str = "aaaaa"; | ||
| const char = "b"; | ||
| 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 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
Task code
CYF-1060
Changelist
Wrote tests and implemented functions