London | 26-ITP-May | Zadri Abdule | Sprint 3 | Practice tdd#1370
Open
Zadri415 wants to merge 7 commits into
Open
London | 26-ITP-May | Zadri Abdule | Sprint 3 | Practice tdd#1370Zadri415 wants to merge 7 commits into
Zadri415 wants to merge 7 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
cjyuan
reviewed
Jun 27, 2026
cjyuan
left a comment
Contributor
There was a problem hiding this comment.
Code looks good. I just have some suggestions.
Comment on lines
+7
to
+10
| * - The function is case-sensitive: 'a' ≠ 'A'. | ||
| * - `stringOfCharacters` may be `null` or `undefined`; in that case the function returns 0. | ||
| * - `findCharacter` is treated as a single character (a single Unicode code point). | ||
| * If you pass a longer string it will never match. |
Contributor
There was a problem hiding this comment.
If these behaviors are expected from the function, then in TDD we should prepare tests to ensure the function meet all these requirements, including
- A test to show the function is case-sensitive: 'a' ≠ 'A'.
- A test to show that the function will return 0 if the 2nd parameter is a string containing more than one character
Comment on lines
+3
to
+5
| if (typeof num !== "number" || Number.isNaN(num)) { | ||
| throw new TypeError("Input must be a number"); | ||
| } |
Contributor
There was a problem hiding this comment.
Note: A stricter check would be to ensure num is an integer.
I don't think ordinal numbers apply to non-integers.
Contributor
|
On separate note, the PR description is missing a "Checklist" heading (a level 2 heading) |
Added validation to ensure input is an integer.
Updated test cases to ensure non-integer inputs throw errors instead of returning ordinal strings.
Contributor
|
Changes look good. Well done. |
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
Changelist
Implemented & added Jest tests for Sprint-3 practice TDD.