London | 26-ITP-May | Zadri Abdule | Sprint 3 | Implement & rewrite tests#1329
London | 26-ITP-May | Zadri Abdule | Sprint 3 | Implement & rewrite tests#1329Zadri415 wants to merge 8 commits into
Conversation
cjyuan
left a comment
There was a problem hiding this comment.
Very solid function implementation and tests.
| expect(isProperFraction(0, -100)).toEqual(true); | ||
| }); | ||
|
|
||
| test(`should return true when absolute value of numerator is less than absolute value of denominator`, () => { |
There was a problem hiding this comment.
Note: Using pseudocode and notations like abs(...) or | ... | is a common and widely accepted practice for describing conditions in a concise manner.
Refactor getCardValue function to remove unnecessary checks for numeric ranks.
| // execute the code to ensure all tests pass. | ||
|
|
||
| const validSuits = ["♠", "♣", "♥", "♦"]; | ||
| const validRanks = ["2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"]; |
There was a problem hiding this comment.
What's the purpose of preparing validRanks? Could using it simplify the solution?
| }); | ||
|
|
||
| // Case 6: Invalid angles | ||
| test(`should return "Invalid angle" when angle is not greater than 0`, () => { |
There was a problem hiding this comment.
Why not simply express "not greater than 0" as <= 0? It's fine to use pseudocode or well-known notation in test descriptions when it makes them more concise. (Same for the "not less than 360")
In this case, <= is a widely recognized operator meaning "less than or equal to".
There was a problem hiding this comment.
... add a test to show that getCardValue checks the suit character too.
I could not find this test.
Learners, PR Template
Self checklist
Changelist
Added Jest tests for Sprint-3 implement and rewrite (exercises 1–3)