Skip to content

Conversation

@Mahtem
Copy link

@Mahtem Mahtem commented Nov 5, 2025

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

Jest testing was performed.

Questions

Any question will be asked in Slack.

@Mahtem Mahtem 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. labels Nov 5, 2025
@Mahtem Mahtem changed the title Manchester |25-ITP-Sep|Mahtem T. Mengstu |Sprint 3 coursework/sprint-3-implement-and-rewrite Manchester |25-ITP-Sep|Mahtem T. Mengstu |Sprint 3|coursework/sprint-3-implement-and-rewrite Nov 5, 2025
Comment on lines 11 to 26
if (numerator < denominator) {
return true;
}
else if (numerator > denominator){
return false;
}
else if (numerator === denominator) {
return false;
}
else if (numerator === 0){
return (true);
}
else if (denominator === 0){
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.

  • The order in which we specify the if statements matter. For example, when numerator is -5 and denominator is 0, the condition on line 11 will evaluate to true and the function will return true immediately when it executes the statement on line 12.

  • According to the definition of proper fraction in mathematics:

    • isProperFraction(-4, 3) should return false
    • isProperFraction(-2, 5) should return true
    • isProperFraction(-1, 1) should return false
    • isProperFraction(-2, -3) should return true

Can you look up the definition of proper fraction and update your function so that it returns the expected value?

Comment on lines +19 to +21
else if (!isNaN(rank )) {
return Number(rank);
}
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 "0002". Do you want to consider these strings as valid ranks?

Comment on lines +40 to +43
test("should identify reflex angle (240)", () => {
expect(getAngleType(240)).toEqual("Reflex angle");
});

Copy link
Contributor

Choose a reason for hiding this comment

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

To ensure thorough testing, we need broad scenarios that cover all possible cases.
Listing individual values, however, can quickly lead to an unmanageable number of test cases.
Instead of writing tests for individual numbers, consider grouping all possible input values into meaningful categories.
Then, select representative samples from each category to test. This approach improves coverage and makes our tests easier to maintain.

For example,

test("should identify reflex angle (180 < angle < 360)", () => {
  expect(getAngleType(300)).toEqual("Reflex angle");
  expect(getAngleType(359.999)).toEqual("Reflex angle");
  expect(getAngleType(180.001)).toEqual("Reflex angle");
});

Comment on lines +15 to +17
test("should return true for a negative fraction", () => {
expect(isProperFraction(-2, 3)).toEqual(true);
});
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 is a bit misleading because not all negative fractions are proper fractions.
For example, -4/3 is an improper fraction.

Comment on lines +11 to +14
test("should number cards for (2-10)", () => {
const aceofSpades = getCardValue("6♠");
expect(aceofSpades).toEqual(6);
});
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 is incomplete.

  • We could test multiple values within a test. The boundary case, 2 and 10, are good candidates to test.

Comment on lines +22 to +25
// test("should return 11 for Ace of Spades", () => {
// const aceofSpades = getCardValue("A♠");
// expect(aceofSpades).toEqual(11);
// });
Copy link
Contributor

Choose a reason for hiding this comment

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

  • We could remove code that's no longer needed (to keep the code clean).

  • The function is not expected to validate the suit character. On line 5, mentioning the suit character in the test description could mislead the person implementing the function into thinking the function needs also to check the suit character.

@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 Nov 8, 2025
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. 📅 Sprint 3 Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants