London | 26-ITP-Jan | Divine Mankrado | Sprint 3 | Practice TDD#1239
London | 26-ITP-Jan | Divine Mankrado | Sprint 3 | Practice TDD#1239divinmank wants to merge 7 commits intoCodeYourFuture:mainfrom
Conversation
This comment has been minimized.
This comment has been minimized.
cjyuan
left a comment
There was a problem hiding this comment.
-
Function implementation is correct.
-
A few tests could use some improvement.
| test("should return 0 if the character does not exist in the string", () => { | ||
| const str = "hello"; | ||
| const char = "z"; | ||
| const count = countChar(str, char); | ||
| expect(count).toEqual(0); | ||
| }); | ||
|
|
||
| test("should return 0 if the character does not exist in the string", () => { | ||
| const str = "hello"; | ||
| const char = "z"; | ||
| const count = countChar(str, char); | ||
| expect(count).toEqual(0); | ||
| }); |
| // Case 4: Numbers ending with 11, 12, 13, or any other digit | ||
| // When the number ends with 11, 12, 13, or any digit not 1, 2, or 3, | ||
| // Then the function should return a string by appending "th" to the number. | ||
| test("should append 'th' for numbers ending with 11, 12, 13, or other digits", () => { |
There was a problem hiding this comment.
When a test fails with the message "... or other digits", it may be unclear what "other digits" actually refers to.
Can you revise the test description to make it more informative?
There was a problem hiding this comment.
Could consider testing a few more samples in this script - higher chance to detect bugs in code.
The original specification did not clearly state whether the character match should be case-sensitive.
Most people would probably assume that it is, but to demonstrate our understanding or clarify the assumption we made,
we could add test cases to convey this. For examples,
- A case to show that the match is case sensitive
- A case to show that the function is expected to work also for non-alphabets
|
Thanks for the feedback!
|
…/divinmank/Module-Structuring-and-Testing-Data into coursework/sprint-3-practice-tdd
Learners, PR Template
Self checklist
Changelist
Finished the practice TDD segment of sprint 3.