Skip to content

Manchester | 26-ITP-Jan | Mehroz Munir | Sprint 3 | Implement and Rewrite tests#1118

Open
MehrozMunir wants to merge 3 commits intoCodeYourFuture:mainfrom
MehrozMunir:coursework/sprint-3-implement-and-rewrite
Open

Manchester | 26-ITP-Jan | Mehroz Munir | Sprint 3 | Implement and Rewrite tests#1118
MehrozMunir wants to merge 3 commits intoCodeYourFuture:mainfrom
MehrozMunir:coursework/sprint-3-implement-and-rewrite

Conversation

@MehrozMunir
Copy link

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

I have completed the exercises of implement and wrote test cases uing jest

@MehrozMunir MehrozMunir added 📅 Sprint 3 Assigned during Sprint 3 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Structuring-And-Testing-Data The name of the module. labels Mar 1, 2026
@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Mar 9, 2026
else return Number(rank);
} catch (e) {
return e.message;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that's right I was not throwing an error. I have fixed it now.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@cjyuan
Copy link
Contributor

cjyuan commented Mar 10, 2026

Please remember to add the "Needs Review" label when the PR is ready to be re-reviewed.

@MehrozMunir MehrozMunir added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-Structuring-And-Testing-Data The name of the module. Reviewed Volunteer to add when completing a review with trainee action still to take. 📅 Sprint 3 Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants