Skip to content

London | 26-Sep-ITP | Frumentius Tesfay | Sprint 2 | Coursework/sprint 3 implement and rewrite - #1698

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

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

Conversation

@Frumentius-Rev

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

Rewrote tests using Jest with some AI assistance and all tests appear to pass.

@Frumentius-Rev Frumentius-Rev added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 13, 2026
@hey-hammad hey-hammad 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 15, 2026

@hey-hammad hey-hammad 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.

Good implementation overall. Thanks


export function isProperFraction(numerator, denominator) {
// TODO: Implement this function
return numerator < denominator;

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 happens if negative values are passed as input?

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.

Negative values are compared normally. Should we allow them as valid inputs?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yes negative number in this case are valid input and should be handled accordingly.

However, the standard definition of a proper fraction focuses on the absolute values of the numerator and denominator. Is there a way to handle absolute values in js?

@hey-hammad hey-hammad 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 15, 2026
@Frumentius-Rev Frumentius-Rev added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 28, 2026
@hey-hammad hey-hammad 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. Reviewed Volunteer to add when completing a review with trainee action still to take. labels Oct 28, 2026

@hey-hammad hey-hammad 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.

Implementation is good overall, however test cases can be improved.

  1. Get Angle Type: the suite should cover boundary values like 0, 89, 90, 179, 180, 181, 359, 360 etc to make the behaviour unambiguous.
  2. Is Proper Fraction: the suite should cover negative values, zero numerator, zero denominator, and sign combinations.
  3. Get Card Value: the suite seems incomplete, it should cover all the cases e.g
  • it should return when Ace → 11(for all the validSuits)
  • it should also cover all the cases when the card is face card or a number card.
  • A better way of doing this is to test Ace, face cards, and all number cards in one loop/array, then test invalid strings separately with exact error assertions for bad rank, bad suit, and malformed input. That makes the suite more complete, easier to read, and much better at catching regressions.


export function isProperFraction(numerator, denominator) {
// TODO: Implement this function
return numerator < denominator;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yes negative number in this case are valid input and should be handled accordingly.

However, the standard definition of a proper fraction focuses on the absolute values of the numerator and denominator. Is there a way to handle absolute values in js?

expect(getCardValue("2♥")).toEqual(2);
});

test("Number card (2-10)", () => {

@hey-hammad hey-hammad Oct 28, 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.

Its better to use test names that describe the expected behavior, not the implementation or category labels.

A better way is to to use the following formula to write test case names:

Behavior + Input + Expected outcome
returns 11 for an ace

@hey-hammad hey-hammad 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 28, 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