Skip to content

London | 26-ITP-May | Zadri Abdule | Sprint 3 | Implement & rewrite tests#1329

Open
Zadri415 wants to merge 4 commits into
CodeYourFuture:mainfrom
Zadri415:sprint-3-rewrite-tests
Open

London | 26-ITP-May | Zadri Abdule | Sprint 3 | Implement & rewrite tests#1329
Zadri415 wants to merge 4 commits into
CodeYourFuture:mainfrom
Zadri415:sprint-3-rewrite-tests

Conversation

@Zadri415
Copy link
Copy Markdown

@Zadri415 Zadri415 commented Jun 2, 2026

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

Changelist

Added Jest tests for Sprint-3 implement and rewrite (exercises 1–3)

@Zadri415 Zadri415 added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Structuring-And-Testing-Data The name of the module. 📅 Sprint 3 Assigned during Sprint 3 of this module labels Jun 2, 2026
Copy link
Copy Markdown
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

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

Very solid function implementation and tests.

Comment on lines +40 to +41
const num = Number(rank);
if (Number.isInteger(num) && num >= 2 && num <= 10) return num;
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.

In JavaScript, strings that represent valid numeric literals in the language can be safely converted to equivalent numbers. For examples, "0x02", "2.000", or "0002".

Does your function return the value you expected from each of the following function calls?

getCardValue("0x02♠");
getCardValue("2.000♠");
getCardValue("0002♠");

Comment on lines +40 to +46
test(`should return "Invalid angle" when invalid`, () => {
expect(getAngleType(-1)).toEqual("Invalid angle");
expect(getAngleType(0)).toEqual("Invalid angle");
expect(getAngleType("90")).toEqual("Invalid angle");
expect(getAngleType(1000)).toEqual("Invalid angle");
expect(getAngleType(9999.999)).toEqual("Invalid angle");
});
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.

  • When a test fails with the message "... when invalid", it may be unclear what "invalid" actually refers to.
    Can you revise the test description to make it more informative?

  • Could also test the other boundary case, 360.

  • Regarding the test expect(getAngleType("90")).toEqual("Invalid angle"):

    • It is not immediately clear why "90" is considered an invalid angle
    • Why "90" is considered invalid, but "91" is not?
    • It may imply the function is expected to check the type of the parameter

expect(isProperFraction(0, -100)).toEqual(true);
});

test(`should return true when absolute value of numerator is less than absolute value of denominator`, () => {
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.

Note: Using pseudocode and notations like abs(...) or | ... | is a common and widely accepted practice for describing conditions in a concise manner.


// Suggestion: Group the remaining test data into these categories:
// Number Cards (2-10)
test(`Should return the numeric value for number cards`, () => {
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.

Could also include a test to show that the function is expected to check the suit character.

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Jun 5, 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 3 Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants