Skip to content

Conversation

Della-Bella
Copy link

Learners, PR Template

Self checklist

  • [X ] I have committed my files one by one, on purpose, and for a reason
  • [X ] I have titled my PR with COHORT_NAME | FIRST_NAME LAST_NAME | REPO_NAME | WEEK
  • [X ] I have tested my changes
  • [X ] My changes follow the style guide
  • [X ] My changes meet the requirements of this task

Changelist

Hi volunteer, good evening

Here is my PR for the Sprint 3.

I have to confess this was the most hard practice so far. The exercises in Implementing directry were so hard for me.
I did need so much help and I know I still have a long way to go to fully understand them.

It was so frustrating but I realize that I’m at a point where I can read and explain the code, think about the operators, and identify some functions I’ll need. However, I haven’t yet reached the point where I can confidently write this JavaScript syntax on my own.

Jumping to the folder Revise it was a completely different experience—much more enjoyable and easier to follow. It gave me hope again that I can do this!

Looking forward to starting the next step.

thank you again for your time and help,
Gislaine

Questions

Ask any questions you have for your reviewer.

@Della-Bella Della-Bella added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Nov 24, 2024
@codrex codrex self-requested a review November 24, 2024 20:57
Copy link

@codrex codrex left a comment

Choose a reason for hiding this comment

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

Thanks for putting so much effort into this. There are a few things I would love you to always take note of before pushing to Github.

  • Check and remove any commented code as they serve no purpose to your code
  • Check and remove any console.log from your code
  • Try to run your tests locally and ensure that they are all passing before pushing your code to Github.

Comment on lines +27 to +31
console.log(getCardValue("A♠")); // Output: 11
console.log(getCardValue("10♣")); // Output: 10
console.log(getCardValue("K♦")); // Output: 10
console.log(getCardValue("5♥")); // Output: 5
console.log(getCardValue("2♠")); // Output: 2
Copy link

Choose a reason for hiding this comment

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

Remember always to remove console logs

Copy link
Author

Choose a reason for hiding this comment

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

ok

Comment on lines 4 to 11
const cardValues = {
A: 11,
K: 10,
Q: 10,
J: 10,
10: 10,
9: 9,
};
Copy link

Choose a reason for hiding this comment

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

I don't see this being used anywhere. Please can you explain what it is used for?

return parseInt(rank, 10);
}
}
module.exports = getCardValue;
Copy link

Choose a reason for hiding this comment

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

Nice work on your implementations so far. But what happens when I pass an invalid number or an unrecognized card face?

Comment on lines +13 to +16
// Handle Number Cards (2-10):
// Given a card with a rank between "2" and "9",
// When the function is called with such a card,
// Then it should return the numeric value corresponding to the rank (e.g., "5" should return 5).
Copy link

Choose a reason for hiding this comment

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

These comments are best written using describe blocks as they are easy to maintain and reason about when reading the code in the future. For example, we can write the above comments as describe blocks as follows.

describe("Handle Number Cards (2-10)", () => {
    test("should return the numeric value for a given card rank", () => {
       // Your actual test
    });
});

Please write your test to follow the above pattern

Copy link
Author

Choose a reason for hiding this comment

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

done ;)

Comment on lines 42 to 66
test(`return true if numerator <0 && >= 1`, function () {
const numerator = -4;
const denominator = 7;
const currentInput = isProperFraction(numerator, denominator);
const targetInput = true;
});

// Equal Numerator and Denominator check:
//is not a proper fraction because the numerator is
// equal to the denominator.
//The function should return false

test(`return false is numerator and demominator are the same`, function () {
const numerator = 3;
const denominator = 3;
const currentInput = isProperFraction(numerator, denominator);
const targetInput = false;
});

test(`return false is numerator and demominator are the same`, function () {
const numerator = 5;
const denominator = 5;
const currentInput = isProperFraction(numerator, denominator);
const targetInput = false;
});
Copy link

Choose a reason for hiding this comment

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

These tests don't seem to have any assertions. Why is this the case?

Comment on lines 7 to 19
const repeatedString1 = repeat("Hello", 3);
console.log(repeatedString1); // Output: "HelloHelloHello"

const repeatedString2 = repeat("Apple is red", 1);
console.log(repeatedString2); // Output: "Apple is red"

const repeatedString3 = repeat("Banana is yellow", 0);
console.log(repeatedString3); // Output: ""

try {
const repeatedString4 = repeat("Orange is orange", -1);
console.log(repeatedString4);
} catch (error) {
Copy link

Choose a reason for hiding this comment

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

Why not have a test file instead?

Copy link
Author

Choose a reason for hiding this comment

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

Add Tests

// Implement a function repeat

function repeat(str, num) {
return str.repeat(num);
Copy link

Choose a reason for hiding this comment

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

Would be nice if you could actually implement the functionality instead of using the built-in one

Copy link
Author

Choose a reason for hiding this comment

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

New Function

test("Should validate a number with at least 5 characters", () => {
const input = 112206;
const output = isNumberValid(input);
expect(output).toBe(true); // A valid number
Copy link

Choose a reason for hiding this comment

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

This should be invalid as the password does not pass all of the criteria.

These are the criteria as password that a valid password need to pass

Have at least 5 characters.

  • Have at least one English uppercase letter (A-Z)
  • Have at least one English lowercase letter (a-z)
  • Have at least one number (0-9)
  • Have at least one non-alphanumeric symbol ("!", "#", "$", "%", ".", "*", "&")
  • Must not be any previous password in the passwords array.

first and get that working
*/

function isNumberValid(input) {
Copy link

Choose a reason for hiding this comment

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

I don't believe this function is doing what it should. Please check the requirements and update your code.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed Password function & and Tests

} else {
return number + "th";
}
}
Copy link

Choose a reason for hiding this comment

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

This looks good but can you test for 111, 112 and 113? I don't think your code covers them correctly

Copy link
Author

Choose a reason for hiding this comment

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

You were right. I fixed the function now.

@codrex codrex 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 26, 2024
@Della-Bella
Copy link
Author

Hello Codex,

Thanks for taking the time to review my code. Honestly, I was a bit lost with these exercises, and I know I need to go over them again. I’ll ask someone for help during the next in-person class.

I appreciate your time and feedback!

Best,
Gislaine

@Della-Bella Della-Bella added the Complete Volunteer to add when work is complete and all review comments have been addressed. label Jan 15, 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. 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.

3 participants