Repository navigation
London | 26-ITP-Sep | Bartosz Kawiak | Sprint 2| Practice-TDD - #1650
bartoszkawiak wants to merge 5 commits into
Conversation
| if (strNum.endsWith("1")) { | ||
| return strNum + "st"; | ||
| } else if (strNum.endsWith("2")) { | ||
| return strNum + "nd"; | ||
| } else if (strNum.endsWith("3")) { | ||
| return strNum + "rd"; | ||
| } else { | ||
| return strNum + "th"; | ||
| } |
There was a problem hiding this comment.
Slight refactor possible here: if we are returning a value from each if statement do we need the else if or is a if statement enough?
Here I'm thinking about cleaning up the code to do the bare minimum, avoiding overengineering when it doesn't actually change the behaviour in the code.
There was a problem hiding this comment.
Removed the unnecessary else statement since "th" is already addressed.
There was a problem hiding this comment.
I misunderstood your original feedback and removed the default return statement. I've corrected this now.
Poonam-raj
left a comment
There was a problem hiding this comment.
I have a few areas I need you to iron out and the repeat-str function needs to be redesigned completely. Please look at my comments and address those changes - thank you
There was a problem hiding this comment.
I've added validation for negative counts so the function throws an error as expected, rather than returning an empty string.
Poonam-raj
left a comment
There was a problem hiding this comment.
thank you for your work on improving this code!
Few tests not passing at the moment, take another look at my remaining comments. Thanks :D


Learners, PR Template
Self checklist
Task code
CYF-1060
Changelist
Completed today’s TDD exercises using Jest. Implemented the required functions and wrote tests to cover the expected behaviour and edge cases.