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
There was a problem hiding this comment.
Thanks. I should have looked at this. Fixed now.
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. |
|
Hi @cjyuan I made sure that i am in the right branch when making changes and I have made changes only in the 3-get-card-value.js and its test file and carefully pushed the code from the same branch. However the git bot is giving me the following error when i am trying to add needs review label. thread 'main' (2433) panicked at src/bin/pr-metadata-validator.rs:64:6: I don't know what is wrong. I have not faced this kind of error before and there is one more strange thing on this page now written beside the name of file "outdated"
|
|
Changes look good. Well done! Don't worry about the validation result. It is caused by something unrelated to your PR. |

Learners, PR Template
Self checklist
Changelist
I have completed the exercises of implement and wrote test cases uing jest