Manchester | 26-ITP-JAN | Abdu Mussa | Sprint 3 |1-implement-and-rewriting-tests/#1141
Manchester | 26-ITP-JAN | Abdu Mussa | Sprint 3 |1-implement-and-rewriting-tests/#1141Abduhasen wants to merge 6 commits intoCodeYourFuture:mainfrom
Conversation
Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js
Show resolved
Hide resolved
Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js
Outdated
Show resolved
Hide resolved
cjyuan
left a comment
There was a problem hiding this comment.
Changes look good. Well done.
Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js
Outdated
Show resolved
Hide resolved
… absolute values of the numerator and the denominator.
|
|
||
| function getAngleType(angle) { | ||
| // TODO: Implement this function | ||
| if (angle > 0 && angle < 90) return "Acute angle"; |
There was a problem hiding this comment.
There are quite a lot of conditionals in here. Do you think there is something other than if-else that could make this simpler, cleaner?
| // Example: Identify Right Angles | ||
| const right = getAngleType(90); | ||
| assertEquals(right, "Right angle"); | ||
| let acute = getAngleType(1); |
There was a problem hiding this comment.
This is very readable, and there is nothing wrong with that. But do you think you need to declare/reassign a variable for each test? How could you make this simpler and less lines of code?
|
|
||
| function isProperFraction(numerator, denominator) { | ||
| // TODO: Implement this function | ||
| if (Math.abs(numerator) < Math.abs(denominator)) return true; |
There was a problem hiding this comment.
I think this could be done in one statement. How do you think it could be done? it'll make the code much simpler as well.
There was a problem hiding this comment.
Also, since these are meant to be used in a division, do you think there needs to be a check to see if the potential division could cause any errors? According to Maths, one of these numbers MUST not be a certain number, or else the division is undefined or erroneous.
(If I'm being vague that's because otherwise it'll reveal the answer 😳 )
| throw new Error("Invalid card"); // This if statement checks the suit is valid with the Array of suit we assigned | ||
| } | ||
| // Based on the question i get form mentor i changed the function if statement for better experience of the code. | ||
| const cardValues = { |
There was a problem hiding this comment.
Do you think there is a better data type to use for a set of cards? 😉
|
@ykamal This PR has already been reviewed. Is there any reason you are reviewing it again? |
cjyuan
left a comment
There was a problem hiding this comment.
I just noticed there are some mistakes in the test descriptions. Can you fixed them?
Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js
Outdated
Show resolved
Hide resolved
… added test as well
| test("should return false when abs(numerator) == 0", () => { | ||
| expect(isProperFraction(0, -1)).toEqual(true); | ||
| expect(isProperFraction(0, 3)).toEqual(true); | ||
| expect(isProperFraction(0, -2)).toEqual(true); | ||
| }); |
There was a problem hiding this comment.
Can you fix this description? It was correct before.
|
All good now. |
Learners, PR Template
Self checklist
Changelist
implement and rewriting of tests
Questions
N/A