Skip to content

Manchester | 26-ITP-Sept | Rahana Suleiman | Sprint 2 | Implement and rewrite tests - #1702

Open
rahanasuleiman8-ship-it wants to merge 1 commit into
CodeYourFuture:mainfrom
rahanasuleiman8-ship-it:coursework/sprint-3-implement-and-rewrite
Open

rahanasuleiman8-ship-it wants to merge 1 commit into
CodeYourFuture:mainfrom
rahanasuleiman8-ship-it:coursework/sprint-3-implement-and-rewrite

Conversation

@rahanasuleiman8-ship-it

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

Task code

CYF-1059

Changelist

This PR implements the getAngleType, isProperFraction, and getCardValue functions alongside comprehensive unit test suites using both node:test and Jest to cover all standard, edge, and invalid input cases.

@github-actions

This comment has been minimized.

@rahanasuleiman8-ship-it rahanasuleiman8-ship-it added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 13, 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 Oct 13, 2026
@rahanasuleiman8-ship-it rahanasuleiman8-ship-it added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 13, 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 Oct 13, 2026
@rahanasuleiman8-ship-it rahanasuleiman8-ship-it added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 14, 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 Oct 14, 2026
@rahanasuleiman8-ship-it rahanasuleiman8-ship-it added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 14, 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 Oct 14, 2026
@rahanasuleiman8-ship-it rahanasuleiman8-ship-it added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 14, 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 Oct 14, 2026
@rahanasuleiman8-ship-it
rahanasuleiman8-ship-it force-pushed the coursework/sprint-3-implement-and-rewrite branch from 27995e0 to 02b9cb7 Compare October 14, 2026 23:35
@rahanasuleiman8-ship-it rahanasuleiman8-ship-it added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 14, 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 Oct 14, 2026
@rahanasuleiman8-ship-it
rahanasuleiman8-ship-it force-pushed the coursework/sprint-3-implement-and-rewrite branch from 02b9cb7 to 6b39842 Compare October 14, 2026 23:43
@rahanasuleiman8-ship-it rahanasuleiman8-ship-it added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 14, 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 Oct 14, 2026
@rahanasuleiman8-ship-it
rahanasuleiman8-ship-it force-pushed the coursework/sprint-3-implement-and-rewrite branch from 6b39842 to 8529aeb Compare October 14, 2026 23:56
@rahanasuleiman8-ship-it rahanasuleiman8-ship-it added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 14, 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 Oct 14, 2026
@rahanasuleiman8-ship-it
rahanasuleiman8-ship-it force-pushed the coursework/sprint-3-implement-and-rewrite branch from 8529aeb to 3e8c9c9 Compare October 15, 2026 00:01
@rahanasuleiman8-ship-it rahanasuleiman8-ship-it added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 15, 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 Oct 15, 2026
@rahanasuleiman8-ship-it
rahanasuleiman8-ship-it force-pushed the coursework/sprint-3-implement-and-rewrite branch from 5055a01 to 21ded3e Compare October 15, 2026 00:06
@rahanasuleiman8-ship-it rahanasuleiman8-ship-it added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 15, 2026
@webmonch
webmonch self-requested a review October 19, 2026 22:06
@webmonch webmonch 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 Oct 19, 2026
});

test("Arbitrary non-card string", () => {
assert.throws(() => getCardValue("invalid"), /Expected a number followed by a suit, but got "invalid"/, "Expected clear error");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is there a particular reason why you updated the provided test here?


// Case 4: Invalid Cards
test("Should throw an error for arbitrary non-card strings", () => {
expect(() => getCardValue("invalid")).toThrow();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can you think of how these test that expect throw can be made more robust?


// Right Angles (angle === 90°)
test("Classifies right angles", () => {
assert.equal(getAngleType(90), "Right angle");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can you spot another test that checks the same thing here?

expect(getAngleType(1)).toEqual("Acute angle");
expect(getAngleType(45)).toEqual("Acute angle");
expect(getAngleType(89)).toEqual("Acute angle");
expect(getAngleType(89.9)).toEqual("Acute angle");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice idea to test decimals close to the boundary! Is there a particular reason to replace 89 rather than keep both values?

throw new Error(`Expected a string, but got ${typeof card}`);
}

const cardRegex = /^(10|[2-9]|[AJQK])([♠♥♦♣])$/;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice! Very clean approach.

@webmonch

Copy link
Copy Markdown

Good job! Very clean implementations and thorough test coverage, especially around the boundaries. Apart from a couple of small issues with the provided tests and formatting - everything looks solid!

@webmonch webmonch 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 Oct 20, 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.

2 participants