Manchester | ITP-JAN-26 | Ofonime Edak | Sprint 3 | Coursework/sprint 3 implement and rewrite#1139
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js
Outdated
Show resolved
Hide resolved
Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js
Outdated
Show resolved
Hide resolved
| }); | ||
|
|
||
| // Case 5: Reflex angles | ||
| test(`Should return "Reflex angle" when (180>angle<360)`, () => { |
There was a problem hiding this comment.
The notation (180>angle<360) is not consistent with the notation used on line 23.
| }); | ||
|
|
||
| // Case 6: Invalid angles | ||
| test(`Should return "Invalid angle" when (0 =<angle>=360)`, () => { |
There was a problem hiding this comment.
How about (angle <= 0 or angle >=360)?
cjyuan
left a comment
There was a problem hiding this comment.
Some of the code is not consistently formatted.
Have you installed the prettier VSCode extension and enabled "Format on save/paste" on VSCode, as recommended in
https://github.com/CodeYourFuture/Module-Structuring-and-Testing-Data/blob/main/readme.md
?
If you have enabled "Format on save" but it is not working, it is likely that you haven't assign a formatter for JS file. This could happen if you have zero or multiple extensions that can format .js file.
If you have installed "Prettier" extension. To assign it as the formatter of JS code, you can try:
- Use "Format document" to format the JS file. Sometimes, VSCode will ask you to choose a formatter, and you can manually select "Prettier".
- Edit
settings.jsonand set Prettier as the default formatter for JS.
See: https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js
Outdated
Show resolved
Hide resolved
| }); | ||
|
|
||
| // Case 5: Reflex angles | ||
| test(`Should return "Reflex angle" when (360<angle>180)`, () => { |
There was a problem hiding this comment.
360<angle>180 -- This notation seems to suggest "angle is greater than 360 and is greater than 180". Can you revise it?
| test(`should return false when denominator is zero`, () => { | ||
| expect(isProperFraction(1, 0)).toEqual(false); | ||
| expect(isProperFraction(1, -1)).toEqual(false); | ||
| expect(isProperFraction(10, 1)).toEqual(false); | ||
| expect(isProperFraction(1, 10)).toEqual(true); | ||
| expect(isProperFraction(-1, 0)).toEqual(false); | ||
| expect(isProperFraction(1e2, 1e4)).toEqual(true); | ||
| expect(isProperFraction(1e4, 1e0)).toEqual(false); | ||
| }); |
There was a problem hiding this comment.
The test description does not quite describe the tests being carried out.
cjyuan
left a comment
There was a problem hiding this comment.
Please note that in CYF courses, the recommended way to inform the reviewer of your changes is to do both of the following:
- Reply to their feedback.
- In the responses, clarify how each piece of feedback was addressed to demonstrate that you've carefully reviewed the suggestions.
- You may find the suggestions in this PR Guide useful.
- Your response may trigger a notification (depending on the reviewer's settings), helping ensure they’re aware of the updates you’ve made.
- In the responses, clarify how each piece of feedback was addressed to demonstrate that you've carefully reviewed the suggestions.
- Replace the "Reviewed" label by a "Needs review" label (which you have done -- great!)
- Without this label, the reviewer would not know if your changes is ready to be reviewed.
Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js
Outdated
Show resolved
Hide resolved
Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js
Outdated
Show resolved
Hide resolved
| expect(isProperFraction(-2, 0)).toEqual(false); | ||
| expect(isProperFraction(-1, 0)).toEqual(false); | ||
| expect(isProperFraction(1, 0)).toEqual(false); | ||
| }); |
There was a problem hiding this comment.
These data categories and samples are not comprehensive enough. You should test also those proper and improper fraction samples you had in implement/2-is-proper-fraction.js.
There was a problem hiding this comment.
Alright, I will improve the test case. Thank you very much
| test(`should return true when denominator is > numerator `, () => { | ||
| expect(isProperFraction(1, 2)).toEqual(true); | ||
| expect(isProperFraction(1, 10000)).toEqual(true); | ||
|
|
||
| expect(isProperFraction(1e2, 1e3)).toEqual(true); | ||
| expect(isProperFraction(-1, 2)).toEqual(true); | ||
| }); | ||
|
|
||
| test("should return false when denominator < numerator", () => { |
There was a problem hiding this comment.
We can use pseudo-code such as abs(...) to more accurately state the condition when the function should return true or false.
Otherwise, isProperFaction(-100, 2) would be expected to return true because 2 > -100.
Self checklist
Changelist
Angle functions
Proper fraction file
Resolved get Card Values
Write test with assertion
Rewrite test with Jest
This PR is on writing functions and carrying out unit test using JS assertion and jest