Skip to content

Manchester | 26-ITP-Sep | Salah Alsabhi | Sprint 2 | implement and rewrite tests - #1667

Open
salahalsabhi wants to merge 5 commits into
CodeYourFuture:mainfrom
salahalsabhi:coursework/sprint-3-implement-and-rewrite
Open

salahalsabhi wants to merge 5 commits into
CodeYourFuture:mainfrom
salahalsabhi:coursework/sprint-3-implement-and-rewrite

Conversation

@salahalsabhi

Copy link
Copy Markdown

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

Task code

CYF-1059

Changelist

Implemented three functions and covered them with tests in both node:test and Jest.

Questions

No questions

@github-actions

This comment has been minimized.

@salahalsabhi salahalsabhi added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 9, 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 9, 2026
@salahalsabhi salahalsabhi changed the title Manchester | 26-ITP-Sep | Salah Alsabhi | Sprint-3 | implement and rewrite tests Manchester | 26-ITP-Sep | Salah Alsabhi | Sprint 3 | implement and rewrite tests Oct 9, 2026
@salahalsabhi salahalsabhi added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 9, 2026
@salahalsabhi salahalsabhi changed the title Manchester | 26-ITP-Sep | Salah Alsabhi | Sprint 3 | implement and rewrite tests Manchester | 26-ITP-Sep | Salah Alsabhi | Sprint 2 | implement and rewrite tests Oct 9, 2026
@hackertainment hackertainment 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 9, 2026

@hackertainment hackertainment left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The implementation looks good. Just need to design more unique/special/boundary test cases. Keep it up.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

While this is correct, I find it may be a bit hard to read. Sometimes using else if may look cleaner.

Comment on lines +25 to +27
test("corrctly get angle type", function(){
assert.equal(getAngleType(400), "Invalid 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.

There should be two boundary cases for invalid angle. Can you think of them? Please add them back.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good coverage of test cases.

Comment on lines +29 to +31
test("Basic proper fraction", () => {
assert.equal(isProperFraction(-1, 2), true);
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good coverage for positive numbers. However, there should be more test cases for negative numbers. Please add them. Thank you.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

There should be more test cases for negative numbers. Please add them. Thank you.

});


// TODO: What other invalid card cases can you think of?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What other invalid card cases can you think of? Please add them. Thank you.

Comment on lines +19 to +29
test(`Should return numeric value for number cards`, () => {
expect(getCardValue("2♥")).toEqual(2);
expect(getCardValue("9♠")).toEqual(9);
expect(getCardValue("10♦")).toEqual(10);
});

test(`Should return 10 for face cards`, () => {
expect(getCardValue("J♣")).toEqual(10);
expect(getCardValue("Q♠")).toEqual(10);
expect(getCardValue("K♥")).toEqual(10);
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

There should be one more special case for valid card. Please add it. Thank you.

Comment on lines +31 to +37
test(`Should throw for invalid cards`, () => {
expect(() => getCardValue("invalid")).toThrow(
/Expected a number followed by a suit, but got "invalid"/
);
expect(() => getCardValue("A")).toThrow(
/Expected a number followed by a suit/
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

There should be more invalid cards to test. Please add them. Thank you.

@hackertainment hackertainment 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 9, 2026
@salahalsabhi

Copy link
Copy Markdown
Author

Thank you for the review, I did most of the notes you mentioned hope all good.

@salahalsabhi salahalsabhi added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. 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