Manchester | 26-ITP-May | Yee Man Tsang | Sprint 3 | 1-implement-and-rewrite-tests#1496
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| return "Right angle"; | ||
| }else if (angle < 180){ | ||
| return "Obtuse angle"; | ||
| }else if (angle == 180){ |
There was a problem hiding this comment.
What's the difference between == and ===? Which one do you think is more appropriate here?
| return true; | ||
| }else{ | ||
| return false; | ||
| } |
There was a problem hiding this comment.
I think there's a nice refactor we could do here... given that numerator < denominator already evaluates to true or false, how might you refactor this solution to not need an if/else statement and just be a single return statement?
| const suit = card.slice(-1); | ||
| //console.log(`number is ${number}`); | ||
| //console.log(typeof suit); | ||
| //console.log(suit); |
There was a problem hiding this comment.
Perfectly valid to use console.log to figure out the problem as we're solving it, but make sure to remove any unnecessary logs and/or comments like these for the final solution 🙂
| console.log("Error thrown for invalid card 🎉"); | ||
| } | ||
|
|
||
| // What other invalid card cases can you think of? |
There was a problem hiding this comment.
Like the comment says - what other invalid card cases can you think?
There was a problem hiding this comment.
Hint: Think of an input that has the right format but isn't valid!
| }); | ||
|
|
||
| // Case 4: Invalid card | ||
| test(`Should return 10 when given an ace card`, () => { |
There was a problem hiding this comment.
I'm not sure this test description matches what the test is checking for!
| expect(getCardValue("4")).toEqual("invalid"); | ||
| expect(getCardValue("")).toEqual("invalid"); | ||
| expect(getCardValue("m")).toEqual("invalid"); | ||
| expect(getCardValue("300")).toEqual("invalid"); |
There was a problem hiding this comment.
In an earlier comment I asked you to consider some further invalid cases for testing. You've added some nice ones here but I think there's still one thing you haven't covered that is worth checking for. Once you've figured that out, it should be included in your Jest tests also!
Learners, PR Template
Self checklist
Changelist
I followed the readme.md and finished the 1-implement-and-rewrite-tests folder