London | 26-ITP-Sep | Mandip Sanger | Sprint 3 | Implement-and-rewrire-tests - #1612
mandipsanger wants to merge 16 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
LonMcGregor
left a comment
There was a problem hiding this comment.
Almost there, just a couple of small comments to fix
Refactored card value retrieval logic to simplify rank checks.
LonMcGregor
left a comment
There was a problem hiding this comment.
You marked my comment about the fractions as resolved, but you don't seem to have addressed my comment. Did you understand it?
Also, did you run the tests before comitting and updating the PR? I get errors when I try to run it.
|
I am still getting a lot of errors when I run the test. Do you also see these when you run the test command? |
|
I have tested most of them now and will do it onces again. for rank i need to use loop and will push it soon. |
abdishakoor-dev
left a comment
There was a problem hiding this comment.
The Jest suite runs clean for me now, 19 tests passing, so that part is sorted. getAngleType is solid.
The fraction function is the main thing left.
-
isProperFraction. A fraction is proper when the numerator is smaller than the denominator ignoring the minus signs. So -4/-5 is proper, and so is 1/-5. Your function returns false for both, and your tests on lines 34 and 38 say false is correct. It is the function that needs to change here, and then those two tests. One more to think about: what shouldisProperFraction(-2, 1)be, and what does your function return for it now? -
getCardValueaccepts some cards it should reject. See my reply on theNumber(rank)line.
Add the Needs Review label again when you have pushed.
|
|
||
| function isProperFraction(numerator, denominator) { | ||
| // TODO: Implement this function | ||
| if (denominator <= 0) { |
There was a problem hiding this comment.
This guard is what makes -4/-5 and 1/-5 come out false. If you compare the sizes of the two numbers ignoring their signs, do you still need it? Check your two zero-denominator tests still pass after the change.
| }); | ||
|
|
||
| test("should return false when denominator is negative", () => { | ||
| expect(isProperFraction(1, -5)).toEqual(false); |
There was a problem hiding this comment.
1/-5 is a proper fraction, because 1 is smaller than 5. This test says false, which matches your code rather than the maths. Line 38 has the same problem.
Self checklist
Task code
CYF-1059
Changelist
Sprint 3 coursework