Skip to content

Conversation

@PaymanIB
Copy link

  • 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

made a new branch so it has no extra files

@PaymanIB PaymanIB added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Nov 22, 2025
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.

Are these files related to Sprint-3 exercise? If not, can you remove them?
They are making code review less convenient.

If they are local configuration files, you can consider updating .gitignore in the top level folder to exclude them from being tracked by Git. Alternatively, you can selectively manually commit only the relevant files (instead of "commit all changes") to the repository.

image

Comment on lines +10 to +28
test("should return false for an improper fraction", () =>{
expect(isProperFraction(5, 2)).toEqual(false);
});

// Case 3: Identify Negative Fractions:
test("should return true for negative proper fraction", () => (
expect(isProperFraction(-4,7)).toEqual(true)
));

// Case 4: Identify Equal Numerator and Denominator:
test("should return false when numerator equals denominator", () => {
expect(isProperFraction(3,3)).toEqual(false);
});

// Stretch:
// What other scenarios could you test for?
test("should return true for negative proper fraction with negative denominator", () => {
expect(isProperFraction(4,-7)).toEqual(true);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

What are your expected range of numerators and denominators?

If you test all possible combinations of positive/negative numerator and denominator, you may discover a bug in your implementation.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for pointing that out. Yes in some other calculations the output will be undefined. I fixed the function.

Copy link
Contributor

Choose a reason for hiding this comment

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

We could make the test more comprehensive by testing all combination of negative and positive parameters.
For example,

test("should return false when numerator and denominator have the same absolute value", () => {
  expect(isProperFraction(3,3)).toEqual(false);
  expect(isProperFraction(3,-3)).toEqual(false);
  expect(isProperFraction(-3,3)).toEqual(false);
  expect(isProperFraction(-3,-3)).toEqual(false);
});

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for clarifying this with an example.

Comment on lines 12 to 18
test("should return numeric value for number cards (2-10)", () => {
const fiveofHearts = getCardValue("5♥");
expect(fiveofHearts).toEqual(5);
});
// Case 3: Handle Face Cards (J, Q, K):
test("should return 10 for face cards (J, Q, K) and 10", () => {
expect(getCardValue("10♦")).toEqual(10);
Copy link
Contributor

Choose a reason for hiding this comment

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

  • 2 and 10 are good boundary cases to test.
  • 10 is normally considered a number card.

Copy link
Author

Choose a reason for hiding this comment

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

CAn you please explain more. So, you mean that I should write a test for 2 as well?

Copy link
Contributor

@cjyuan cjyuan Nov 25, 2025

Choose a reason for hiding this comment

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

In your test category for number cards, you only tested one rank, "5".
To make the test more comprehensive, we should test more samples, and boundary cases, 2 and 10, are usually good candidates to test. Since the sample size is small, a test that checks all numbers from 2 to 10 would be even better.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for clarifying this. I tried to do both. so first I wrote tests for boundary (2 & 10) which are commented now.. and then wrote a test to cover all numbers.

Comment on lines 24 to 26
test("should return 11 for Ace (A)", () => {
expect(getCardValue("A♦")).toEqual(11);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

This test and the test on lines 7-9 are quite similar.

Copy link
Author

Choose a reason for hiding this comment

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

Noted, Thank you. I removed this one.

@cjyuan cjyuan 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 Nov 22, 2025
@PaymanIB
Copy link
Author

Thanks @cjyuan , I tried my best to address all the points that you have mentioned. Can you please check it out.

@PaymanIB PaymanIB 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 Nov 25, 2025
@cjyuan
Copy link
Contributor

cjyuan commented Nov 25, 2025

Changes look good. Some of the tests could be made more comprehensive. (You can improve them later when you have time).

Can you remove unrelated changes introduced to this branch?

@cjyuan cjyuan 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 Nov 25, 2025
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