Manchester | 26-ITP-Jan | Mehroz Munir | Sprint 3 | Implement and Rewrite tests#1118
Conversation
Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js
Outdated
Show resolved
Hide resolved
Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js
Show resolved
Hide resolved
Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js
Outdated
Show resolved
Hide resolved
| else return Number(rank); | ||
| } catch (e) { | ||
| return e.message; | ||
| } |
There was a problem hiding this comment.
This requirement has not yet been met:
// When the card string is invalid (not following the above format), the function should
// throw an error
Currently your function returns a string when a card is invalid.
Note: The error is supposed to be thrown to the caller.
There was a problem hiding this comment.
Yes that's right I was not throwing an error. I have fixed it now.
There was a problem hiding this comment.
I have created a separate function with the name assertThrows in the 3-get-card-value.js file to catch the error. But, I am not sure how can I test this thrown error in 3-get-card-value.test.js file where I am using jest test.
There was a problem hiding this comment.
See lines 43-45 in 3-get-card-value.test.js
// To learn how to test whether a function throws an error as expected in Jest,
// please refer to the Jest documentation:
// https://jestjs.io/docs/expect#tothrowerror
Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js
Show resolved
Hide resolved
|
Please remember to add the "Needs Review" label when the PR is ready to be re-reviewed. |
Learners, PR Template
Self checklist
Changelist
I have completed the exercises of implement and wrote test cases uing jest