-
-
Notifications
You must be signed in to change notification settings - Fork 165
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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) => { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Sprint-3/implement/get-card-value.js
Outdated
return 11; | ||
throw new Error("Invalid card rank"); | ||
/* | ||
const error = new Error("Invalid card rank"); //create the error |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
Sprint-3/implement/rotate-char.js
Outdated
|
||
const rotateCharacter = (char, shift) => { | ||
const alphabet = 'abcdefghijklmnopqrstuvwxyz'; | ||
const ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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`; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.🙏
Learners, PR Template
Self checklist
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.