Skip to content

Conversation

@TzeMingHo
Copy link

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

For the 3 exercises, I have created assert conditions and tests for each case, as well as some stretch cases.

…wer case to upper case and replace all space with underline
@TzeMingHo TzeMingHo added 📅 Sprint 3 Assigned during Sprint 3 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Sep 23, 2025
@jenny-alexander jenny-alexander self-requested a review October 4, 2025 13:55
@jenny-alexander jenny-alexander 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 4, 2025
Copy link

@jenny-alexander jenny-alexander left a comment

Choose a reason for hiding this comment

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

Good job covering most test cases @TzeMingHo - I left a few comments for you to review.

// complete the rest of the tests and cases
// write one test at a time, and make it pass, build your solution up methodically

function isProperFraction(numerator, denominator) {

Choose a reason for hiding this comment

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

Your isProperFraction works well. However, if you wanted to simplify it even more, you could try:

// this will return either true or false
return (Math.abs(numerator) < Math.abs(denominator));

Choose a reason for hiding this comment

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

What would happen if I run the test with:

  • angle: 'ten'
  • angle: 1000
  • angle: -22
  • angle: null

// Input: numerator = "a", denominator = 2
// target output: false
// Explanation: The function should handle non-numeric inputs gracefully. In this case, we choose to return false.
const invalidInputs = isProperFraction("a", 2);

Choose a reason for hiding this comment

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

👏 Good job making sure that 'unhappy path' is tested.

Choose a reason for hiding this comment

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

When I run your tests, I get this result:
Assertion failed: Expected 1♠ to equal Error: Invalid card rank
Assertion failed: Expected Z♠ to equal Error: Invalid card rank
Assertion failed: Expected to equal Error: Invalid card rank

Can you take a look?

Choose a reason for hiding this comment

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

I tried a few more 'unhappy path' tests:

  • card value of true
  • card value of 22
  • card value of null

I was expecting ('Error: Invalid card rank').

@jenny-alexander jenny-alexander 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 8, 2025

Choose a reason for hiding this comment

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

I think you included this file by mistake.

@TzeMingHo TzeMingHo added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Oct 8, 2025
Copy link

@jenny-alexander jenny-alexander left a comment

Choose a reason for hiding this comment

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

You're almost there! Most everything is passing now except /implement/3-get-card-value.js.

// Then, write the next test! :) Go through this process until all the cases are implemented

function getAngleType(angle) {
if (

Choose a reason for hiding this comment

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

I see where you are going with this. :)
It can be simplified to this:

if (angle === null || isNaN(Number(angle))) {
  return "Input should be a number or a number in string";
}

⏫ You don't have to modify your code - I am simply pointing out a small improvement for 'next time' you do something similar to this.

// just make one change at a time -- don't rush -- programmers are deep and careful thinkers
function getCardValue(card) {
const errorMessage =
"Error: Invalid card rank. Input should be a string in the format 'R♠', where R is 2-10, J, Q, K, or A, followed by either ♠, ♥, ♦, or ♣.";

Choose a reason for hiding this comment

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

I suggest keeping the error message simple here:
'Error: Invalid card rank'

Right now, your tests are failing because the message you are expecting isn't the same as the one you are receiving. If you change the error message to 'Error: Invalid rank', it should pass correctly.

💡 Make sure that you run your tests before you submit your PR.

Image

});
// Case 5: Handle Invalid Cards:
const errorMessage =
"Error: Invalid card rank. Input should be a string in the format 'R♠', where R is 2-10, J, Q, K, or A, followed by either ♠, ♥, ♦, or ♣.";

Choose a reason for hiding this comment

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

I suggest changing the error message back to something more simple and readable: Error: Invalid card rank.

@jenny-alexander jenny-alexander 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 Oct 11, 2025
@TzeMingHo TzeMingHo added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Oct 11, 2025
@jenny-alexander
Copy link

Your PR looks good now. Good job!

@jenny-alexander jenny-alexander 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 Oct 12, 2025
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 3 Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants