Skip to content

Cape Town | 2026-ITP-Jan | Isaac Abodunrin | Sprint 3 | Implement and Rewrite Tests Coursework#956

Open
bytesandroses wants to merge 14 commits intoCodeYourFuture:mainfrom
bytesandroses:coursework/sprint-3-implement-and-rewrite
Open

Cape Town | 2026-ITP-Jan | Isaac Abodunrin | Sprint 3 | Implement and Rewrite Tests Coursework#956
bytesandroses wants to merge 14 commits intoCodeYourFuture:mainfrom
bytesandroses:coursework/sprint-3-implement-and-rewrite

Conversation

@bytesandroses
Copy link
Member

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

Implemented solutions to the following, using console.assert() for basic testing:

  • 1-get-angle-type.js
  • 2-is-proper-fraction.js
  • 3-get-card-value.js

Rewrite tests for the solutions above using Jest

@bytesandroses bytesandroses added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Feb 10, 2026
Copy link
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 thorough tests! Well done!

Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't 0/1 a proper fraction?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch -- you're absolutely right since the definition of a proper fraction is where the magnitude of the denominator is great than that of the numerator. It doesn't say the numerator can't be zero, so I've updated the code to correct this

Copy link
Contributor

Choose a reason for hiding this comment

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

With this way of expressing the test, the test description
Should return ${rank} when given a card ${cardFace}
would appear 36 times on the console (with different ranks and suits).

Should you need to reduce the number of messages on the console, you can consider grouping similar test cases under one category as

test(`Should return the numerical value of number cards`, () => {
  const cardsNumbers = [2, 3, 4, 5, 6, 7, 8, 9, 10];
  for (const rank of cardsNumbers) {
    for (const suit of suits) {
      const cardFace = `${rank}${suit}`;
      expect(getCardValue(cardFace)).toEqual(rank);
    }
  }
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the tip. I've refactored it so that similar test cases use one category -- there are a lot fewer printouts in the console now

@cjyuan cjyuan 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 Feb 18, 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

Comments