Skip to content

West Midland | ITP-May-2025 | Saleh Yousef | Module-Structuring-and-Testing-Data | sprint 3 #601

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

SalehOmar-Y
Copy link

@SalehOmar-Y SalehOmar-Y commented Jun 24, 2025

Learners, PR Template

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with REGION | COHORT_NAME | FIRST_NAME LAST_NAME | PROJ_NAME
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

Completed sprint 3 coursework

Questions

Ask any questions you have for your reviewer.

SalehOmar-Y and others added 9 commits June 8, 2025 12:37
new file: prep/example.js
…date tests for accuracy; complete getAngleType function and enhance test cases for clarity and coverage.
…test cases for negative fractions and equal numerator/denominator scenarios.
…s in a string; add tests for various scenarios including no occurrences.

Implement getOrdinalNumber function to return correct ordinal representations; enhance tests for multiple cases including special teen cases.
@SalehOmar-Y SalehOmar-Y added Needs Review Participant to add when requesting review 📅 Sprint 3 Assigned during Sprint 3 of this module labels Jun 24, 2025
@cjyuan cjyuan added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Participant to add when requesting review labels Jul 4, 2025
Comment on lines 2 to 6
if (card === "A") return 11;
if (["K", "Q", "J", "10"].includes(card)) return 10;
const num = Number(card);
if (num >= 2 && num <= 9 && card === num.toString()) return num;
throw new Error("Invalid card rank.");
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this function pass all the tests in Sprint-3/2-mandatory-rewrite/3-get-card-value.test.js?

Copy link
Author

Choose a reason for hiding this comment

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

Previously it wasn’t - now I’ve simplified the getCardValue function to extract the rank using slice(0, -1), and cleaned up the logic to handle each valid case cleary.

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Jul 4, 2025
@SalehOmar-Y SalehOmar-Y added Needs Review Participant to add when requesting review and removed Reviewed Volunteer to add when completing a review labels Jul 6, 2025
Copy link
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

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

All the other changes look good.

Comment on lines 6 to 7
const num = Number(rank);
if (num >= 2 && num <= 9) return num;
Copy link
Contributor

Choose a reason for hiding this comment

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

In JavaScript, strings that represent valid numeric literals in the language can be safely converted to equivalent numbers. For examples, "0x02", "2.1", or "00_02".

Does your function return the value you expected from each of the following function calls?

getCardValue("0x02♠");
getCardValue("2.1♠");
getCardValue("00_02♠");

Copy link
Author

Choose a reason for hiding this comment

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

fixed, the earlier function had loose logic.

Comment on lines 8 to 14
test("should return 5 for Five of Hearts", () => {
expect(getCardValue("5♥")).toEqual(5);
expect(getCardValue("3♣")).toEqual(3);
expect(getCardValue("4♦")).toEqual(4);


});
Copy link
Contributor

Choose a reason for hiding this comment

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

The test description does not quite match the values being tested.

Copy link
Author

Choose a reason for hiding this comment

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

I’ve fixed the description so it matches the actual test values now. Thank you

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review and removed Needs Review Participant to add when requesting review labels Jul 6, 2025
@SalehOmar-Y SalehOmar-Y added Needs Review Participant to add when requesting review and removed Reviewed Volunteer to add when completing a review labels Jul 6, 2025
@cjyuan
Copy link
Contributor

cjyuan commented Jul 7, 2025

Changes look good. Well done!

@cjyuan cjyuan added Complete Volunteer to add when work is complete and review comments have been addressed and removed Needs Review Participant to add when requesting review labels Jul 7, 2025
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 review comments have been addressed 📅 Sprint 3 Assigned during Sprint 3 of this module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants