-
-
Notifications
You must be signed in to change notification settings - Fork 214
NW | 25-ITP-Sep | TzeMing Ho | Sprint 3 | coursework/sprint-3-practice-tdd #710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
NW | 25-ITP-Sep | TzeMing Ho | Sprint 3 | coursework/sprint-3-practice-tdd #710
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job @TzeMingHo following the principles of TDD. I added a few comments that wll help you write more reliable code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might have been a leftover from debugging, but console logs should be removed before submitting your PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have written some good tests cases that cover the main cases. However, can you think of some edge cases that should be tested?
- what if str is not a string (i.e. a number)
- what if count is not a number (i.e. "2")
- what if string is empty or null, what should it return?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your test case covers the most basic cases - but can you think of some edge cases you should write tests for?
- what is count is 2.5?
- what if the count is null or undefined
- what if the string is an array or an object instead of a string?
Writing tests to cover edge cases will protect your implementation from unexpected situations and make your code more robust.
Learners, PR Template
Self checklist
Changelist
In the exercises, I wrote tests first, followed by writing functions to fulfill them. Some edge cases were also attempted to be implemented in the tests.