Skip to content

London | Haftamu Hailu | Module-Structuring-and-Testing-Data|Sprint3|Structuring and testing excercise 3| WEEK3 #157

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

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

Conversation

HaftamuKebedew
Copy link

@HaftamuKebedew HaftamuKebedew commented Nov 17, 2024

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

Briefly explain your PR.
In this exercise, I try to construct some code based on the supplied statement and certain validations using test by installing jest and creating a script on the package.json

Questions

Ask any questions you have for your reviewer.

@SallyMcGrath SallyMcGrath added Needs Review Participant to add when requesting review Reviewed Volunteer to add when completing a review and removed Needs Review Participant to add when requesting review labels Nov 24, 2024
Copy link
Member

@SallyMcGrath SallyMcGrath left a comment

Choose a reason for hiding this comment

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

It's getting there @HaftamuKebedew , but I can't see any assertions in your implement folder. This suggests you aren't building up your solutions test first, which is the goal of this sprint.

Can you talk through your process a bit?

@@ -25,3 +25,19 @@
// Identify Reflex Angles:
// When the angle is greater than 180 degrees and less than 360 degrees,
// Then the function should return "Reflex angle"

const getAngleType = (angleInDegree) => {
Copy link
Member

Choose a reason for hiding this comment

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

Nice! I wonder, is there a way you could refactor this to make it a little simpler and clearer? Do you need all these elses?

Copy link
Author

Choose a reason for hiding this comment

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

I have remove else part.

return 11;
throw new Error("Invalid card rank");
/*
const error = new Error("Invalid card rank"); //create the error
Copy link
Member

Choose a reason for hiding this comment

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

Why is this commented out?

Copy link
Author

Choose a reason for hiding this comment

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

I have removed the comment It does no thing here.That it the same with the throw new Error. I use to check in different syntax of the error


const rotateCharacter = (char, shift) => {
const alphabet = 'abcdefghijklmnopqrstuvwxyz';
const ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
Copy link
Member

Choose a reason for hiding this comment

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

Do you need a lowercase and uppercase array here? Is there a string method that can do this for you?

Copy link
Author

Choose a reason for hiding this comment

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

I have updated it to String method.


const validateCreditCard = (cardNumber) => {

if (cardNumber.length !== 16)
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't look functional?

Copy link
Author

Choose a reason for hiding this comment

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

I have updated the function.

const lastTwoDigits = absNum % 100;

if (lastTwoDigits >= 11 && lastTwoDigits <= 13) {
return `${Math.floor(num)}th`;
Copy link
Member

Choose a reason for hiding this comment

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

Can you talk through what Math.floor is doing in your function?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, I use it to round down to the largest integer less than or equal to the given number. eg if the value is
Given value->Output after floor
13.3 ----->13
16.5------>16
16.7------>16
Then at the end th will be added. That is the reason why I use Math.floor() method

Copy link
Author

Choose a reason for hiding this comment

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

As I understand it, I strive to update the exercises based on the feedback you provide. Please let me know if I did it correctly, and I greatly appreciate your time and attention.

Thank you for your comments.🙏

@SallyMcGrath SallyMcGrath added the 👀 Review Testing Changes requested to do with testing label Nov 30, 2024
@HaftamuKebedew HaftamuKebedew added the Complete Volunteer to add when work is complete and review comments have been addressed label Dec 7, 2024
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 review comments have been addressed 👀 Review Testing Changes requested to do with testing Reviewed Volunteer to add when completing a review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants