Skip to content

London | 26-ITP-May | Damilola Odumosu| Sprint 3 | coursework - #1528

Open
d-odumosu wants to merge 19 commits into
CodeYourFuture:mainfrom
d-odumosu:coursework/sprint-3-implement-and-rewrite
Open

London | 26-ITP-May | Damilola Odumosu| Sprint 3 | coursework#1528
d-odumosu wants to merge 19 commits into
CodeYourFuture:mainfrom
d-odumosu:coursework/sprint-3-implement-and-rewrite

Conversation

@d-odumosu

Copy link
Copy Markdown

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

Completed implementing and rewriting tests

@d-odumosu d-odumosu 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 Jul 19, 2026
@cjyuan cjyuan added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Jul 24, 2026
Comment thread Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js Outdated
Comment thread Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js Outdated

// Suit and rank validation
if (!validSuits.includes(suit)) {
throw new Error("Invalid card played, suit is missing");

@cjyuan cjyuan Jul 24, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The suit character may not be "missing". For examples, card could be "3♡" (instead of "3♥") or "3♥ ".

Could you think of a more general error message?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yes, changes made, thank you

Comment on lines +26 to +31
if (card === "") {
throw new Error("No card was played")
}
if (card.length < 2 || card.length > 3) {
throw new Error("Invalid card played, rank and suit cannot be less than 1 or more than 3")
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What do "played" and "suit cannot be less than 1 or more than 3" mean?

Are these checks necessary?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I am validating the length of the card played, i see it might be redundant since i already have suit and rank validation, i will remove the code

expect(getAngleType(359)).toEqual("Reflex angle");
})
// Case 6: Invalid angles
test(`should return "Invalid angle" when (0 > angle > 360)`, () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The notation 0 > angle > 360 tends to suggests angle is between two values. Could you change the notation?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

thank you, change made.

// Special case: numerator is zero
test(`should return false when denominator is zero`, () => {
expect(isProperFraction(1, 0)).toEqual(false);
test("should correctly identify proper fractions", () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could probably break this test category into several more specific test categories.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

reimplemented the tests, thank you

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Jul 24, 2026
Comment on lines 8 to 13
test(`should return "Invalid angle" when angle is less than 0 or greater than 360')`, () => {
// Test various acute angles, including boundary cases
expect(getAngleType(1)).toEqual("Acute angle");
expect(getAngleType(45)).toEqual("Acute angle");
expect(getAngleType(89)).toEqual("Acute angle");
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This does not look correct.

Comment on lines +51 to +64
if (!validSuits.includes(suit)) {
throw new Error("Invalid card: suit is not recognised");
}
if (validRanks.includes(rank)) {
if (rank === "A") {
return 11;
} else if (rank === "J" || rank === "Q" || rank === "K") {
return 10;
} else {
throw new Error("Invalid rank");
return Number(rank);
}

} else {
throw new Error("Invalid rank");
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could consider organizing the code in this manner (esp. when the invalid cases can be determined easily):

  // Code to check for all invalid cases
  if ( ... ) throw ...
  if ( ... ) throw ...

  // Code to deal only with valid values

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

all changes have been made, thank you

@d-odumosu
d-odumosu requested a review from cjyuan July 30, 2026 21:14
});
// Case 6: Invalid angles
test(`should return "Invalid angle" when (0 > angle > 360)`, () => {
test(`should return "Invalid angle" when angle is less than zero or angle is greater than 360)`, () => {

@cjyuan cjyuan Aug 1, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This test description is still not quite correct.

"Greater than" means >, which is not the same as >=.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-Structuring-And-Testing-Data The name of the module. 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