London | 26-ITP-May | Damilola Odumosu| Sprint 3 | coursework - #1528
London | 26-ITP-May | Damilola Odumosu| Sprint 3 | coursework#1528d-odumosu wants to merge 16 commits into
Conversation
|
|
||
| // Suit and rank validation | ||
| if (!validSuits.includes(suit)) { | ||
| throw new Error("Invalid card played, suit is missing"); |
There was a problem hiding this comment.
The suit character may not be "missing". For examples, card could be "3♡" (instead of "3♥") or "3♥ ".
Could you think of a more general error message?
| if (card === "") { | ||
| throw new Error("No card was played") | ||
| } | ||
| if (card.length < 2 || card.length > 3) { | ||
| throw new Error("Invalid card played, rank and suit cannot be less than 1 or more than 3") | ||
| } |
There was a problem hiding this comment.
What do "played" and "suit cannot be less than 1 or more than 3" mean?
Are these checks necessary?
There was a problem hiding this comment.
I am validating the length of the card played, i see it might be redundant since i already have suit and rank validation, i will remove the code
| expect(getAngleType(359)).toEqual("Reflex angle"); | ||
| }) | ||
| // Case 6: Invalid angles | ||
| test(`should return "Invalid angle" when (0 > angle > 360)`, () => { |
There was a problem hiding this comment.
The notation 0 > angle > 360 tends to suggests angle is between two values. Could you change the notation?
| // Special case: numerator is zero | ||
| test(`should return false when denominator is zero`, () => { | ||
| expect(isProperFraction(1, 0)).toEqual(false); | ||
| test("should correctly identify proper fractions", () => { |
There was a problem hiding this comment.
Could probably break this test category into several more specific test categories.
There was a problem hiding this comment.
reimplemented the tests, thank you
Self checklist
Changelist
Completed implementing and rewriting tests