London | JAN-2026 ITP | Asha Ahmed | Sprint 3 | implement and rewrite tests coursework #1035
Conversation
…and invalid angles
…o, negative, decimal, and large numbers
…ce cards, and Invalid cards
| @@ -50,3 +64,33 @@ try { | |||
| } catch (e) {} | |||
There was a problem hiding this comment.
The catch block can be improved. it's currently empty
There was a problem hiding this comment.
You are referring to the original CodeYourFuture code example, which I did not write. The question I was asked was “What other invalid card cases can you think of?” (see below), not to modify the code you are commenting on.
|
|
||
| // What other invalid card cases can you think of? | ||
|
|
||
| try { |
There was a problem hiding this comment.
An empty catch block is not good practice.
Fix the catch blocks in this file
There was a problem hiding this comment.
My answers are based on the example given above.
There was a problem hiding this comment.
Avoid empty catch. At the very least, there should be a comment in the empty block explaining why you're swallowing the exception at that point or output the exception.
Look up the standard on how to write a try and catch block; it would help fix the syntax.
There was a problem hiding this comment.
I'm still learning JavaScript, so I’ll look into catch blocks as I’m not entirely sure what you mean yet. My understanding was that the code is technically correct, and my answers were based on the example provided by CodeYourFuture above. Given that, it feels like a big change to fix the file itself rather than respond to the questions asked.
| // Case 1: Ace (A) | ||
| test(`Should return 11 when given an ace card`, () => { | ||
| expect(getCardValue("A♠")).toEqual(11); | ||
| expect(getCardValue("A♣")).toEqual(11); |
There was a problem hiding this comment.
These are duplicated test lines. Is there a reason for this?
There was a problem hiding this comment.
I don't think this is a duplication. We have two codes who have different purpose: one for spades and one for clubs. Can you please check again?
Learners, PR Template
Self checklist
Changelist
Implemented getAngleType, isProperFraction, and getCardValue solutions.
Rewrote tests using Jest to cover expected cases, including boundary/invalid inputs.
Questions
n/a