Skip to content

London | 26-ITP-Sep | Mars Adesina | Sprint 2 | Implement and rewrite tests - #1718

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

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

Conversation

@marscancode

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

I implemented the three functions:

  1. getAngleType
  2. isProperFraction
  3. getCardValue
    I also created tests in Node and Jest for all three functions.

@marscancode marscancode added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. 📅 Sprint 2 Assigned during Sprint 2 of this module Module-Structuring-And-Testing-Data The name of the module. labels Oct 15, 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 Oct 23, 2026
Comment on lines +17 to +21
if(numerator < denominator){
return true;
} else{
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.

Format (spacing) not fully consistent. Why not use a formatter to keep the code consistently format?

@@ -1,3 +1,3 @@
import { isProperFraction } from "../implement/2-is-proper-fraction.js";

// TODO: Write tests in Jest syntax to cover all combinations of positives, negatives, zeros, and other categories.

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 test cases in this script do not yet include cases involving negative numbers.

Are $\frac{-2}{3}$, $\frac{2}{-3}$ (which equals to $-\frac{2}{3}$) and $\frac{-2}{-3}$ (which equals to $\frac{2}{3}$) proper fractions? What is the definition of proper fraction?

test("Arbitrary non-card string", () => {
expect(() => getCardValue("invalid")).toThrow(
/Expected a valid number followed by a suit, but got "invalid"/
);

@cjyuan cjyuan Oct 23, 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.

Why test the error message as

    expect(() => getCardValue("invalid")).toThrow(
      /Expected a valid number followed by a suit, but got "invalid"/
    );

instead of as

    expect(() => getCardValue("invalid")).toThrow(
      'Expected a valid number followed by a suit, but got "invalid"'
    );

?

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.

Tests are very comprehensive. Excellent job.

@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 Oct 23, 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 2 Assigned during Sprint 2 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants