Skip to content

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

Open
d-odumosu wants to merge 10 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 10 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 on lines +14 to +18
if (Number.isFinite(numerator) && Number.isFinite(denominator)) {
if(numerator < denominator){
return true
}
} return false

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 are the expected value of these function calls?
  isProperFraction(-1, 0)
  isProperFraction(-1, -5);

Comment on lines +32 to +33
const rank = card.slice(0, card.length - 1).toUpperCase()
const suit = card.slice(card.length - 1)

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.

.slice() accepts negative index. card.slice(card.length - 1) is identical to card.slice(-1).


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

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?

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?

// 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.

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