Skip to content

London | 26-Sept | Hugh Mills | Sprint 2 | Implement and rewrite tests - #1670

Open
HM-127BTY wants to merge 60 commits into
CodeYourFuture:mainfrom
HM-127BTY:coursework/sprint-2-implement-and-rewrite
Open

HM-127BTY wants to merge 60 commits into
CodeYourFuture:mainfrom
HM-127BTY:coursework/sprint-2-implement-and-rewrite

Conversation

@HM-127BTY

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 built code while writing tests for the code using node and jest to test.

added in code for checks for J Q K and A
valid single digit card
Arbitrary non-card string
Incorrect suit
Copied test code for other angles.
Added in test for Basic proper fraction: Numerator < Denominator
Added code for Number cards 2-10
fixed error on numbered cards.
@HM-127BTY HM-127BTY added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 13, 2026
@hackertainment hackertainment removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 13, 2026
@HM-127BTY HM-127BTY added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 16, 2026
@hackertainment

Copy link
Copy Markdown

About card test cases, the design process could be:

for valid case:

  • any of 2-9 (single digit number) with valid suit
  • number 10 (double digit number) with valid suit
  • J/Q/K with valid suit (because they should return 10)
  • A with valid suit (because it should specially return 11)

for invalid case:

  • 1 (single digit number) with valid suit
  • 11 (special double digit number) with valid suit
  • any of 12-99 (double digit number) with valid suit
  • any B-Z except J/Q/K with valid suit
  • any invalid face with valid suit
  • valid suit with valid face (e.g. "♠9")
  • any invalid face with any invalid suit
  • any of 2-9 (valid single digit number) with invalid suit
  • number 10 (valid double digit number) with invalid suit
  • J/Q/K with invalid suit
  • A with invalid suit

If you have the above planning before actual coding the test cases, then you can make sure that all combinations would be covered. Similar to my previous comment on #1670 (comment) , draft the test plan in English first, then write the test in code. Once again, please feel free to book a mentored coding session with a volunteer.

I think after you tidy up the test cases in implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js and implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js, this PR should be completed. Thank you for your effort.

// any B-Z except J/Q/K with valid suit
test("Incorrect royal face given: 7L", () => {
assert.throws(
() => getCardValue("7L"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This should be () => getCardValue("L♦"), I think. I will let you pass this time but please pay attention to detail in the future. Thank you.


// number 10 (double digit number) with valid suit
test(`Should return 10 value when given an 10 face card`, () => {
expect(getCardValue("2♠")).toEqual(2);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This should be expect(getCardValue("10♠")).toEqual(10);, I think. I will let you pass this time but please pay attention to detail in the future. Thank you.

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.

Woops, thanks and I thought I went through it with a microscope.

@hackertainment

hackertainment commented Oct 19, 2026 •

Copy link
Copy Markdown

I would mark this PR as completed. Please book a mentored coding session with volunteer if you would like to learn better. Thank you.

@hackertainment hackertainment 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. Reviewed Volunteer to add when completing a review with trainee action still to take. labels Oct 19, 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. 📅 Sprint 2 Assigned during Sprint 2 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants