Skip to content

Manchester | 26-ITP-May | Yee Man Tsang | Sprint 3 | 1-implement-and-rewrite-tests#1496

Open
lintsang wants to merge 1 commit into
CodeYourFuture:mainfrom
lintsang:coursework/sprint-3-implement-and-rewrite
Open

Manchester | 26-ITP-May | Yee Man Tsang | Sprint 3 | 1-implement-and-rewrite-tests#1496
lintsang wants to merge 1 commit into
CodeYourFuture:mainfrom
lintsang:coursework/sprint-3-implement-and-rewrite

Conversation

@lintsang

@lintsang lintsang commented Jul 11, 2026

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

Changelist

I followed the readme.md and finished the 1-implement-and-rewrite-tests folder

@github-actions

This comment has been minimized.

@lintsang lintsang added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 11, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 11, 2026
@lintsang lintsang added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 11, 2026
@Liam310 Liam310 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 Jul 14, 2026
return "Right angle";
}else if (angle < 180){
return "Obtuse angle";
}else if (angle == 180){

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's the difference between == and ===? Which one do you think is more appropriate here?

return true;
}else{
return 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.

I think there's a nice refactor we could do here... given that numerator < denominator already evaluates to true or false, how might you refactor this solution to not need an if/else statement and just be a single return statement?

const suit = card.slice(-1);
//console.log(`number is ${number}`);
//console.log(typeof suit);
//console.log(suit);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Perfectly valid to use console.log to figure out the problem as we're solving it, but make sure to remove any unnecessary logs and/or comments like these for the final solution 🙂

console.log("Error thrown for invalid card 🎉");
}

// What other invalid card cases can you think of?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Like the comment says - what other invalid card cases can you think?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hint: Think of an input that has the right format but isn't valid!

});

// Case 4: Invalid card
test(`Should return 10 when given an ace card`, () => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I'm not sure this test description matches what the test is checking for!

Comment on lines +38 to +41
expect(getCardValue("4")).toEqual("invalid");
expect(getCardValue("")).toEqual("invalid");
expect(getCardValue("m")).toEqual("invalid");
expect(getCardValue("300")).toEqual("invalid");

@Liam310 Liam310 Jul 14, 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.

In an earlier comment I asked you to consider some further invalid cases for testing. You've added some nice ones here but I think there's still one thing you haven't covered that is worth checking for. Once you've figured that out, it should be included in your Jest tests also!

@Liam310 Liam310 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 Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants