Skip to content

London | 26-ITP-Sep | Alan Mak | Sprint 2 | Implement and rewrite tests - #1695

Open
AlanGit-debug2604 wants to merge 18 commits into
CodeYourFuture:mainfrom
AlanGit-debug2604:Sprint2-Coursework
Open

AlanGit-debug2604 wants to merge 18 commits into
CodeYourFuture:mainfrom
AlanGit-debug2604:Sprint2-Coursework

Conversation

@AlanGit-debug2604

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

Write implementation, node tests, and Jest tests for 1-get-angle; 2-is-proper-fraction; and 3-get-card-values.
Tested and passed tests.

Questions

Housekeeping question: followed by npm installation in Prep, should package.json stay with coursework folder and commit. The reason of this question: in package.json configuration `"devdependencies" : "jest : "^30.5.2" has set up. Is the placement of this file essential to run jest test for implementation files?

AlanGit-debug2604 and others added 18 commits October 9, 2026 16:42
…d edge cases: not a number, not a finite number, 0 as denominator
… type of card ; define Rank and Suit composing value of card, define validRanks and valid Suits;
…oper fraction, 0 numerator, 0 denominator, non-numeric numerator , non-numeric denominator, not a number (NaN), infinity denominator
@AlanGit-debug2604 AlanGit-debug2604 added 📅 Sprint 2 Assigned during Sprint 2 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Oct 13, 2026
@webmonch
webmonch self-requested a review October 19, 2026 20:48
@webmonch webmonch 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 19, 2026
@@ -18,4 +18,33 @@

export function getAngleType(angle) {

@webmonch webmonch Oct 19, 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.

What would this function return for 360 and 0 degree angles?

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.

The function returns Reflex angle for 360, and Acute angel for 0 degree respectively.


// Special case: numerator is zero
test(`should return false when denominator is zero`, () => {
expect(isProperFraction(1, 0)).toEqual(false);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is there a particular reason why you updated the provided test here?

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.

I chose .toThrow(Error) rather than .toEqual(false) in this particular context where the denominator is zero because my understanding to fraction in mathematics, a zero denominator leads to infinitive outcome also known as an Error, therefore I chose .toThrow(Error) to preserve this mathematical implication.

assert.equal(getCardValue("9♠"), 9);
});

test("Arbitrary non-card string", () => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Did you remove this test on purpose?

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.

I removed this test because "Invalid Rank" and "Invalid Suit" tests serve the purpose to tell user invalid character input in each and respective scenarios, in this case this test ("both characters invalid") then seems to be redundant.
My initial intention was to write test case which will tell user AT ONCE both characters are invalid for input like "1x"("non-card string" or "not-a-valid-card-string"). And originally, I placed this test below "Invalid Suit" at the bottom.
I realized, (in the case this test place below "Invalid Rank") the code will throw error from Invalid Rank and stop even prior to run "both characters invalid" test.
Then, even I tried to place "both characters invalid" BEFORE "Invalid" tests (as the sequence now you notice), this test does not return result as expected or stuck the whole piece of code.
Therefore, I removed this test as a trade-off and rather break the error into two separate tests for user to explore invalid input in each and respective scenarios.

@webmonch

Copy link
Copy Markdown

Good job! Very thorough test coverage and the planning comments show a clear thought process. Just a couple of boundary cases in getAngleType to have another look at, plus a few tests that were changed from the original task. Apart from that, everything looks solid!

@webmonch webmonch 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 19, 2026
@AlanGit-debug2604 AlanGit-debug2604 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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. 📅 Sprint 2 Assigned during Sprint 2 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants