Repository navigation
Manchester | 26-ITP-Sept | Rahana Suleiman | Sprint 2 | Practice TDD - #1691
Open
rahanasuleiman8-ship-it wants to merge 8 commits into
Open
rahanasuleiman8-ship-it wants to merge 8 commits into
rahanasuleiman8-ship-it wants to merge 8 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
… and negative values
rahanasuleiman8-ship-it
force-pushed
the
coursework/sprint-3-practice-tdd
branch
from
October 12, 2026 23:53
b39816b to
a1f5c71
Compare
hackertainment
left a comment
There was a problem hiding this comment.
The code generally looks ok to me. Keep it up.
Comment on lines
12
to
17
| 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?
Comment on lines
+24
to
+29
| test("should return 0 when the character is not found 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 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
This PR completes the TDD exercises for countChar, getOrdinalNumber, and a custom repeatStr implementation, fully covered by passing unit test suites verified via npm run test