Skip to content

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

Open
MehrozMunir wants to merge 5 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 5 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

Copy link
Author

Choose a reason for hiding this comment

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

Thanks. I should have looked at this. Fixed now.

@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
@MehrozMunir MehrozMunir added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Mar 11, 2026
@MehrozMunir
Copy link
Author

MehrozMunir commented Mar 11, 2026

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:
Failed to validate PR: UserFacing("Failed to parse issue #1246 - no submit label.\n\nIf this issue was made my a curriculum team member it should be given a sprint label.\nIf this issue was created by a trainee for step submission, it should probably be closed (and they should create the issue in their fork).")
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
Error: Process completed with exit code 101.

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"

Screenshot from 2026-03-11 14-41-47

@cjyuan
Copy link
Contributor

cjyuan commented Mar 11, 2026

Changes look good. Well done!

Don't worry about the validation result. It is caused by something unrelated to your PR.

@cjyuan cjyuan added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Reviewed Volunteer to add when completing a review with trainee action still to take. labels Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed. Module-Structuring-And-Testing-Data The name of the module. 📅 Sprint 3 Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants