Skip to content

Conversation

@Alaa-Tagi
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

I have created a PR with completed tasks as required.

Questions

No questions.

@Alaa-Tagi Alaa-Tagi 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. Module-Structuring-And-Testing-Data The name of the module. labels Oct 12, 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.

One of the Jest test scripts has not been updated accordingly.

if (angle < 90 && angle > 0) {
return "Acute angle";
}
if (angle > 90 && angle < 180) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Checking angle > 90 is optional because previous if-statements can guarantee angle is always more than 90.

Comment on lines 11 to 20
if (numerator < denominator) {
return true;
}
if (numerator < 0 && Math.abs(numerator) < denominator) {
return false;
}
if (numerator >= denominator) {
return false;
}
// we could add more checks here for invalid input, but not required for this exercise
Copy link
Contributor

Choose a reason for hiding this comment

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

According to the definition of proper fraction in mathematics:

  • isProperFraction(-4, 3) should return false
  • isProperFraction(-2, 5) should return true
  • isProperFraction(-1, 1) should return false
  • isProperFraction(-2, -3) should return true

Can you look up the definition of proper fraction and update your function accordingly?

Comment on lines 20 to 22
test("should return false for equal numerator and denominator", () => {
expect(isProperFraction(3, 3)).toEqual(false);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

For each test, we could include multiple test cases that belong to the same category to make the test more complete in the following way:

test("should return false for equal numerator and denominator", () => {
  expect(isProperFraction(3, 3)).toEqual(false);
  expect(isProperFraction(-3, 3)).toEqual(false);
  expect(isProperFraction(3, -3)).toEqual(false);
  expect(isProperFraction(-3, -3)).toEqual(false);
});

Comment on lines 15 to 17
test("should return false for a negative fraction", () => {
expect(isProperFraction(-1, 2)).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.

The test description does not quite match the specified test.

@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 Oct 23, 2025
@Alaa-Tagi Alaa-Tagi 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 23, 2025
@cjyuan
Copy link
Contributor

cjyuan commented Oct 24, 2025

Changes look good but not all comments had been addressed.

@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 Oct 24, 2025
Expanded test cases for isProperFraction function to include various scenarios such as negative fractions, zero numerator, negative denominator, and large numbers.
@Alaa-Tagi Alaa-Tagi 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 24, 2025
Refactor isProperFraction function to include input type checks and handle division by zero. Update logic to determine if a fraction is proper based on the value of the numerator and denominator.
Updated test cases for isProperFraction function to improve clarity and coverage. Added detailed descriptions for each test case.
@cjyuan
Copy link
Contributor

cjyuan commented Oct 25, 2025

There are three files in the "rewrite" folder and you updated only two of them.

@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 Oct 25, 2025
@Alaa-Tagi
Copy link
Author

@cjyuan,
I have face unusal issue. the third file was showing on my VScode but not on my PR. when back to check I had a conflict message. There were unstaged files that's why I had this issue.

@Alaa-Tagi Alaa-Tagi 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 25, 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.

I have face unusal issue. the third file was showing on my VScode but not on my PR. when back to check I had a conflict message. There were unstaged files that's why I had this issue.

Is a good opportunity to learn resolving conflict. :)
If you have backed up your files, then the worst that could happen is that you need to submit a new PR.

Comment on lines 11 to 14
test("should return 7 for 7 of Hearts", () => {
const sevenOfHearts = getCardValue("7♥");
expect(sevenOfHearts).toEqual(7);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

When preparing tests, we should ensure the tests cover all possible cases. If we specify a test for individual card, we will need about 53 tests to cover all possible cases. Instead, we could consider classifying all possible values into different categories, and then within each category we test some samples.

For example, one possible category for getCardValue() is, "should return the value of number cards (2-10)", and we can prepare the test as

test("should return the value of number cards (2-10)", () => {
    expect(getCardValue("2♣︎")).toEqual(2);
    expect(getCardValue("5♠")).toEqual(5);
    expect(getCardValue("10♥")).toEqual(10);
    // Note: We could also use a loop to check all values from 2 to 10.
});

Comment on lines 16 to 31
test("should return 10 for Jack of Diamonds", () => {
const jackOfDiamonds = getCardValue("J♦");
expect(jackOfDiamonds).toEqual(10);
});

//Case 4
test("should return 10 for Queen of Clubs", () => {
const queenOfClubs = getCardValue("Q♣");
expect(queenOfClubs).toEqual(10);
});

test("should return 10 for King of Spades", () => {
const kingOfSpades = getCardValue("K♠");
expect(kingOfSpades).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.

  • Face cards (J, Q, K) can also be considered a category

  • The function is not expected to check the suit character. Mentioning the suit character in the test description could send the wrong signal to the person implementing the function.

@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 Oct 25, 2025
@Alaa-Tagi Alaa-Tagi 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 26, 2025
@cjyuan
Copy link
Contributor

cjyuan commented Oct 26, 2025

Have you double checked what you changed?

@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 Oct 26, 2025
Comment on lines 17 to 27
<<<<<<< HEAD
// Case 2: Improper fraction
// When numerator > denominator, it should return false.
test("should return false for an improper fraction", () => {
=======
// Case 2: Improper Fraction
// Given a numerator greater than denominator (5/2),
// When the function is called,
// Then it should return false because it's an improper fraction.
test("should return false for an improper fraction (5/2)", () => {
>>>>>>> 52740052fb0ad97a2c7253a04978b14a15b9e763
Copy link
Contributor

Choose a reason for hiding this comment

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

The <<<<<<< HEAD, =======, and >>>>>>> are markers added by Git to show the difference between two versions of a conflicting file.

The difference between the two versions of the conflicting file are indicated by these markers as:


<<<<<<< HEAD

Content from version A

=======

Content from version B

>>>>>>> 52740052fb0ad97a2c7253a04978b14a15b9e763


Note: In your file, the long hexadecimal number following >>>>>>>> is probably the commit SHA of version B.

To resolve the conflict, you will need to manually delete all the unwanted content and the markers in an editor.

Copy link
Author

Choose a reason for hiding this comment

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

@cjyuan, I have delete it

@Alaa-Tagi Alaa-Tagi 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 26, 2025
Comment on lines 4 to 13
// Case 1: Proper fraction
// When numerator < denominator, it should return true.
test("should return true for a proper fraction", () => {
=======

// Case 1: Proper Fraction
// Given a numerator smaller than denominator (2/3),
// When the function is called,
// Then it should return true because it's a proper fraction.
test("should return true for a proper fraction (2/3)", () => {
>>>>>>> 52740052fb0ad97a2c7253a04978b14a15b9e763
Copy link
Contributor

Choose a reason for hiding this comment

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

In addition to deleting the markers, you would also need to decide what to do with the conflicting content (those code between the marker). Normally, we just need to delete the code from one version and keep the other one.

In this example, code on lines 3-5 is from version A and code on lines 6-11 is from version B.
If you read the comments, you can see two // Case 1: .....

At current state, this test file won't execute.

Copy link
Author

Choose a reason for hiding this comment

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

deleted double cases

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

Labels

Module-Structuring-And-Testing-Data The name of the module. Reviewed Volunteer to add when completing a review with trainee action still to take. 📅 Sprint 3 Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants