Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Karla Grajales | Sprint-3 - Module-Structuring-and-Testing-Data | SPRINT 3 #238

Open
wants to merge 32 commits into
base: main
Choose a base branch
from

Conversation

Grajales-K
Copy link

Learners, PR Template

Self checklist

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

Changelist

In this project, I learned to create simpler, well-structured functions without overcomplicating them. I focused on interpreting instructions carefully to ensure the code behaves as expected. Additionally, I explored how to install Jest, write test cases, and debug them effectively. I also learned to use assertions to validate functionality and handle errors by throwing them instead of returning them, which helped improve the clarity and reliability of the code.

Questions

Ask any questions you have for your reviewer.

@Grajales-K Grajales-K added 🔑 Priority Key Do this first 📅 JS1 📅 Sprint 3 Assigned during Sprint 3 of this module Needs Review Participant to add when requesting review labels Dec 31, 2024
@Grajales-K Grajales-K closed this Jan 2, 2025
@Grajales-K Grajales-K reopened this Jan 2, 2025
Copy link

@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.

Most of the code are pretty solid.
I left you some comments and suggestions.

Sprint-3/implement/get-card-value.js Outdated Show resolved Hide resolved
Sprint-3/implement/is-proper-fraction.js Outdated Show resolved Hide resolved
Sprint-3/implement/is-valid-triangle.js Outdated Show resolved Hide resolved
Sprint-3/implement/is-valid-triangle.js Outdated Show resolved Hide resolved
Sprint-3/implement/rotate-char.js Outdated Show resolved Hide resolved
Sprint-3/revise/implement/password-validator.test.js Outdated Show resolved Hide resolved
Sprint-3/revise/implement/repeat.js Outdated Show resolved Hide resolved
Sprint-3/revise/implement/repeat.test.js Outdated Show resolved Hide resolved
Sprint-3/revise/investigate/find.js Outdated Show resolved Hide resolved
@cjyuan cjyuan added Reviewed Volunteer to add when completing a review and removed Needs Review Participant to add when requesting review labels Jan 2, 2025
@Grajales-K Grajales-K requested a review from cjyuan January 16, 2025 07:01
@Grajales-K Grajales-K added the Needs Review Participant to add when requesting review label Jan 16, 2025
Copy link

@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.

Changes look good. I just have few suggestions. Feel free to mark this as Completed.

const rank = input.slice(0, -1);

// Check if the rank is a valid numeric value or face card
if (!isNaN(rank) && Number(rank) >= 2 && Number(rank) <= 10) {
Copy link

Choose a reason for hiding this comment

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

A string representing a decimal numbers such as "2.3" could still pass this test.

A bulletproof approach would be to check if rank is exactly one of "2", "3", ..., "10" before doing the number conversion.

}

// If numerator is equal to denominator, it's not a proper fraction
if (numerator === denominator) {
Copy link

Choose a reason for hiding this comment

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

The condition at line 49 can also handle this case.


// Calculate the new character code
// const rotatedCode = (upperLetter.charCodeAt(0) - baseCode + num) % 26 + baseCode;
const rotatedCode = (upperLetter.charCodeAt(0) - baseCode + num + 26) % 26 + baseCode;
Copy link

Choose a reason for hiding this comment

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

If we allow num to be a very "large" negative number (e.g., -1000), we can rewrite line 30 as
const rotatedCode = (upperLetter.charCodeAt(0) - baseCode + num % 26 + 26) % 26 + baseCode;

Note: num % 26 would reduce any value of num to the range [-25, 25].

});

test("password too short", () => {
expect(passwordValidation("Shor!", existingPasswords)).toBe(false);
Copy link

Choose a reason for hiding this comment

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

"Shor!" has 5 characters. :)

@cjyuan cjyuan removed the Needs Review Participant to add when requesting review label Jan 16, 2025
@Grajales-K
Copy link
Author

Changes look good. I just have few suggestions. Feel free to mark this as Completed.

thank you @cjyuan I will have a look this again, thank you so much for your time.

@Grajales-K Grajales-K added the Complete Participant to add when work is complete and review comments have been addressed label Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Complete Participant to add when work is complete and review comments have been addressed 📅 JS1 🔑 Priority Key Do this first Reviewed Volunteer to add when completing a review 📅 Sprint 3 Assigned during Sprint 3 of this module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants