Manchester | 26-ITP-May | Yee Man Tsang | Sprint 3 | 1-implement-and-rewrite-tests - #1496
Manchester | 26-ITP-May | Yee Man Tsang | Sprint 3 | 1-implement-and-rewrite-tests#1496lintsang wants to merge 3 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| 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!
There was a problem hiding this comment.
I tried to think about anything I may miss and think maybe if the input is a number instead if string. Hope this is what you are asking to check
There was a problem hiding this comment.
It's good to consider these cases - but it's not exactly what I had in mind.
When I say in the right format, I mean "a number followed by a suit". So "4♦" is in the right format and is a totally valid input! But what about "16♦"? That's "a number followed by a suit", but is it valid?
There was a problem hiding this comment.
Got it. This is included in the testing case now. Thanks
| // test(`Should return invalid as the case is not valid`, () => { | ||
| // expect(getCardValue("invalid")).toEqual("invalid"); | ||
| // expect(getCardValue("♦")).toEqual("invalid"); | ||
| // 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.
Don't leave commented out code - if it's not relevant any more, it can be removed 🙂
| @@ -45,11 +42,11 @@ function getCardValue(card) { | |||
| case "9": | |||
| return Number(number); | |||
There was a problem hiding this comment.
sorry I missed this earlier... what about something like "10♥"? Is that valid or invalid? How would it be handled by your function?
There was a problem hiding this comment.
Yes, you are right. I have missed the card 10.
|
Great work @lintsang! Just one comment I don't think you quite resolved and I've left a couple of other small ones. Almost there now 🙂 |
|
Many thanks to your feedback Liam |
Learners, PR Template
Self checklist
Changelist
I followed the readme.md and finished the 1-implement-and-rewrite-tests folder