-
-
Notifications
You must be signed in to change notification settings - Fork 197
West Midlands | 25-ITP-May | Mustaf Asani | Module-Structuring-and -Testing-Data | Sprint 3 #679
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?
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.
Good start on this sprint. There are a few tasks you should review as there are some logic issues in your code. Also make sure not to commit package files by accident
@@ -9,6 +9,11 @@ | |||
|
|||
function isProperFraction(numerator, denominator) { | |||
if (numerator < denominator) return true; |
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.
What happens if I give it a negative improper fraction, like -20/2?
return 11; | ||
} else if (rank === "K" || rank === "Q" || rank === "J" || rank === "10") { | ||
return 10; | ||
}else if (rank >= "2" && rank <= "9") { |
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.
If I give it a strange value like "222♥" what would you expect the output to be? What actually happens?
@@ -1,6 +1,12 @@ | |||
function isProperFraction(numerator, denominator) { | |||
if (numerator < denominator) return true; | |||
if (Math.abs(numerator) < Math.abs(denominator)) return true; |
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.
This is a more correct solution - you may want to use it in your earlier task
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.
Don't commit package
files unless you are making a deliberate necessary change to the node setup - can you remove it from here, and the other places it is present in this commit?
return "3rd"; | ||
case 4: | ||
return "4th"; | ||
case 5: |
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.
There is a lot of duplication here - can you think of a way to make this code a bit cleaner?
(Hint: You did a better job in the next part of the if branch)
} | ||
} else if(num > 10 && num < 21) { | ||
return num + "th"; | ||
} else if (num > 20) { |
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.
What about 111? We would usually state that as "111th".
// Case 10: Identify the ordinal number for 10 | ||
test("should return '10th' for 10", () => { | ||
expect(getOrdinalNumber(10)).toEqual("10th"); | ||
}); |
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 should consider testing all your branches - what about the larger numbers?
Learners, PR Template
Self checklist
Changelist
sprint 3 tasks completed
Questions
Ask any questions you have for your reviewer.