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 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?

Copy link
Author

Choose a reason for hiding this comment

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

Thank you, for bringing that insight. I have tried to modify the if statement and add necessary test.

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");
});

Copy link
Author

Choose a reason for hiding this comment

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

Thank you, I have modified the tests to cover broader scenarios.

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.

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 is right, I have changed the misleading description into "should return true for a proper fraction with negative numerator".

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.

Copy link
Author

Choose a reason for hiding this comment

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

Thank you, I have completed the incomplete description and added a test for multiple values such as boundary cases 2 and 10 in line 12-17

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.

Copy link
Author

Choose a reason for hiding this comment

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

Good, that's right, I have removed misleading description. and changed it.

@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
@cjyuan
Copy link
Contributor

cjyuan commented Nov 10, 2025

Can you also address all my inline comments? You can see them on #851

(Sorry, thought you had finished making changes)

@Mahtem
Copy link
Author

Mahtem commented Nov 12, 2025

Can you also address all my inline comments? You can see them on #851

(Sorry, thought you had finished making changes)

I have addressed all your inline comments.
Thank you for your patience.

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