Skip to content

Birmingham | ITP-Jan-26 | Ayodeji Ayorinde | Sprint 3| 1-implement-and-rewrite-tests#1215

Open
Ayogit1 wants to merge 3 commits intoCodeYourFuture:mainfrom
Ayogit1:1-implement-and-rewrite-tests
Open

Birmingham | ITP-Jan-26 | Ayodeji Ayorinde | Sprint 3| 1-implement-and-rewrite-tests#1215
Ayogit1 wants to merge 3 commits intoCodeYourFuture:mainfrom
Ayogit1:1-implement-and-rewrite-tests

Conversation

@Ayogit1
Copy link

@Ayogit1 Ayogit1 commented Mar 7, 2026

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

Completion of 1-implement-and-rewrite-tests tasks

@Ayogit1 Ayogit1 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 7, 2026
@jayshreehajgude2012 jayshreehajgude2012 added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Mar 11, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 11, 2026
@cjyuan cjyuan added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 18, 2026
Comment on lines 24 to 36
function getCardValue(card) {
// TODO: Implement this function
rankCard = card.slice(0, 1);
if (rankCard === "A") {
return 11;
} else if (rankCard === "J" || rankCard === "Q" || rankCard === "K") {
return 10;
} else if (+rankCard >= 2 && +rankCard <= 10) {
return +rankCard;
} else {
return rankCard.toThrow();
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

  • The function is expected to also validate if the last character is a valid suit character.

  • In JavaScript, strings that represent valid numeric literals in the language can be safely converted to equivalent numbers. For examples, "0x02", "2.1", or "0002".
    Does your function return the value you expected from each of the following function calls?

getCardValue("0x02♠");
getCardValue("2.1♠");
getCardValue("0002♠");

Comment on lines +41 to +44
test(`should return "Invalid angle" when (angle > 360)`, () => {
// Test various acute angles, including boundary cases
expect(getAngleType(90)).toEqual("Invalid angle");
}); No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

  • The condition about invalid angle is not quite correct.

  • Can your function pass this test?

Comment on lines +14 to +21
test(`should return false when denominator is zero`, () => {
expect(isProperFraction(1, 7)).toEqual(false);
});

// Special case: negatives
test(`should return false when denominator is zero`, () => {
expect(isProperFraction(1, -7)).toEqual(false);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

The description of the tests do not match the tests being carried out.

// Number Cards (2-10)

test("Should return 2–10 for their respective card values", () => {
const cards = ["2", "3", "4", "5", "6", "7", "8", "9", "10"];
Copy link
Contributor

Choose a reason for hiding this comment

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

A valid card should also have a valid suit character.
For example, "2♥". "2" should be considered an invalid card.

expect(getCardValue(card)).toEqual(Number("Invalid"));

});
});
Copy link
Contributor

Choose a reason for hiding this comment

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

  • Test descriptions do not match the tests being carried out.

  • The function is expected to throw an error when the given card is invalid.

    • Suggestion: Lookup how to throw error in JS, and follow the links line 44 to find out how to check if a function can throw an errors as expected in Jest.

Comment on lines +15 to +19
if (numerator < denominator) {
return "true";
} else {
return "false";
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you lookup if -1/-2, 1/-2, -1/2, -1/0 are considered proper fractions, and then update
your implementation and tests accordingly?

@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 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants