Skip to content

London | 26-ITP-Sep | Abakar Souleyman | Sprint 3 | implement-and-rewrite-tests - #1660

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

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

Conversation

@abmhts

@abmhts abmhts commented Oct 8, 2026

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

Completed the implementation and rewrote the tests using node:test and jest.

@abmhts abmhts added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 8, 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.

Thank you for your coursework. Please keep it up.

Comment on lines +29 to +32
test("Classifies for angles outside the valid range.", () => {
const invalid = getAngleType(361);
assert.equal(invalid, "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 case for angles outside the valid range. Can you think of them? Please add them into this test suite. Thank you.

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.

Added the lower boundary (exactly 0°) and upper boundary (exactly 360°). 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.

Good coverage of test cases. Well done!

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I don't think this program runs correctly for positives, negatives, and zeros. Can you fix it? Thank you.

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.

Added Math.abs to return absolute value of the number. 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.

The test cases should also include negatives and zeros. Please add them back. Thank you.

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.

Included negatives and zeros. Thank you.

Comment on lines +21 to +23
test(`should return false when numerator is (-)`, () => {
expect(isProperFraction(-1, 0)).toEqual(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.

The description does not match the expected output. Which one is correct?

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.

Corrected. Thanks

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 covering different combination of positive and negative values. Please add them back. Thank you.

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.

Added more test cases. 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.

I am not quite sure about the correctness of this program. Please fix the following issues:

  1. formatting (e.g. indentation, brackets, etc)
  2. making if and else if cleaner to read, covering all possible combinations (instead of hardcode specific values)
  3. try to store card.slice(0, -1) into a variable and reuse it (instead of slice it multiple times)

If you find it difficult to approach this problem, try to book a mentored coding session and work this out with a volunteer together.

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.

  1. I cleaned up the indentation and corrected the misplaced brackets in the number check.
  2. Cleaner if / else if: I removed the hardcoded cards and now check the rank against groups (ace, face cards, number cards), so every valid combination works.
  3. Reused slice: I stored card.slice(0, -1) in a rank variable (and card.slice(-1) in suit) so each is sliced once and reused.

Thank you.

@hackertainment hackertainment Oct 11, 2026 •

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 fix, and it looks much better now. Hope you would appreciate the importance of writing clean code :-)

@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
@abmhts abmhts added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Oct 11, 2026
@hackertainment

Copy link
Copy Markdown

Congratulation, you have completed this PR successfully.

@hackertainment hackertainment added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants