Skip to content

Sheffield | May-2025 | Declan Williams | Sprint-3 #623

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 42 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
be25f2c
Implement acute angle identification in getAngleType function and add…
CatchingKiyoko Jun 17, 2025
4fa86db
Fix syntax error in acute angle test case
CatchingKiyoko Jun 17, 2025
d317d4f
Implement angle type identification for obtuse, straight, and reflex …
CatchingKiyoko Jun 17, 2025
dea34f8
Add tests for identifying obtuse angles in getAngleType function
CatchingKiyoko Jun 17, 2025
952fd14
Add test cases for identifying reflex angles in getAngleType function
CatchingKiyoko Jun 17, 2025
8cf3f58
Implement acute angle identification in getAngleType function
CatchingKiyoko Jun 18, 2025
6da0615
Implement obtuse angle identification in getAngleType function and ad…
CatchingKiyoko Jun 18, 2025
45209eb
Implement straight angle identification in getAngleType function and …
CatchingKiyoko Jun 18, 2025
37f345d
Implement reflex angle identification in getAngleType function and ad…
CatchingKiyoko Jun 18, 2025
ed4eaf3
Implement card value retrieval for face cards and number cards in get…
CatchingKiyoko Jun 23, 2025
a0d4fcf
Implement numerical value retrieval for cards 2-9 in getCardValue fun…
CatchingKiyoko Jun 23, 2025
d32c392
Enhance getCardValue function comments and add error handling for inv…
CatchingKiyoko Jun 23, 2025
e7f3d74
Fix typo in error message assertion for invalid card rank in getCardV…
CatchingKiyoko Jun 23, 2025
2e2d63c
Implement card value retrieval for all ranks in getCardValue function
CatchingKiyoko Jun 23, 2025
900385e
Add tests for number card values 2-10 in getCardValue function
CatchingKiyoko Jun 23, 2025
67c92c2
Add tests for face cards (J, Q, K) in getCardValue function
CatchingKiyoko Jun 23, 2025
60ed74f
add tests for handling Aces in getCardValue function
CatchingKiyoko Jun 23, 2025
bcdba1c
fix: correct expect statement for Ace value in getCardValue tests
CatchingKiyoko Jun 23, 2025
a16c211
add test for handling invalid card ranks in getCardValue function
CatchingKiyoko Jun 23, 2025
aced4d1
refactor: implement character counting logic in countChar function
CatchingKiyoko Jun 25, 2025
0a913b0
add test for handling no occurrences of a character in countChar func…
CatchingKiyoko Jun 25, 2025
de7632b
refactor: implement getOrdinalNumber function to return correct ordin…
CatchingKiyoko Jun 27, 2025
aa7b3ee
reimplmented module.exports for jest tests
CatchingKiyoko Jun 27, 2025
d2a8646
fix: correct ordinal suffix casing in getOrdinalNumber function
CatchingKiyoko Jun 27, 2025
9798ed9
refactor: remove console.log statements from getOrdinalNumber function
CatchingKiyoko Jun 27, 2025
63a66e2
test: add test cases for ordinal numbers 2 and 3 in getOrdinalNumber …
CatchingKiyoko Jun 27, 2025
c89c3b8
test: enhance test cases for ordinal numbers 1, 2, and 3 in getOrdina…
CatchingKiyoko Jun 27, 2025
2b44bf7
fix: correct conditional check for special cases in getOrdinalNumber …
CatchingKiyoko Jun 27, 2025
df5287d
test: update test descriptions for ordinal numbers and implemented a…
CatchingKiyoko Jun 27, 2025
1f02ed6
implemented repeat function with error handling and edge cases with …
CatchingKiyoko Jun 28, 2025
900db99
fix: correct typo in error message for negative count in repeat function
CatchingKiyoko Jun 28, 2025
5d2265b
refactor: comment out console log examples in repeat function
CatchingKiyoko Jun 28, 2025
525641a
test: add test case for returning original string when count is 1
CatchingKiyoko Jun 28, 2025
4f81c7d
test: add test case for handling count of 0 in repeat function
CatchingKiyoko Jun 28, 2025
d34ba19
test: add test case for handling negative count in repeat function
CatchingKiyoko Jun 28, 2025
dd38ca5
fix: add missing assertions for negative and equal fraction checks
CatchingKiyoko Jun 28, 2025
5798163
fix: clarify return statement in isProperFraction function
CatchingKiyoko Jun 28, 2025
a8d9ac3
test: add missing test case for improper fraction
CatchingKiyoko Jun 28, 2025
1a34fcf
test: add missing test case for negative fraction
CatchingKiyoko Jun 28, 2025
c5d4342
test: add missing test case for equal fraction
CatchingKiyoko Jun 28, 2025
e4b3cf0
fix: add input validation for angle in getAngleType function
CatchingKiyoko Jul 18, 2025
885b7d5
fix: updated isProperFraction logic to handle division by zero and si…
CatchingKiyoko Jul 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Sprint-3/2-mandatory-rewrite/1-get-angle-type.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function getAngleType(angle) {
if (typeof angle !== "number" || angle <= 0 || angle > 360) return "Invalid angle";
Copy link
Contributor

Choose a reason for hiding this comment

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

This is good.
Since NaN is also of type "number", you could also consider rejecting NaN.


if (angle === 90) return "Right angle";
// replace with your completed function from key-implement
if (angle < 90)
Expand Down
4 changes: 2 additions & 2 deletions Sprint-3/2-mandatory-rewrite/2-is-proper-fraction.js
Copy link
Contributor

Choose a reason for hiding this comment

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

In mathematics, -4/7 == 4/-7, and -4/-7 == 4/7.
So, ideally isProperFraction() should recognise all of them as proper fractions.

Similarly, -5/2 == 5/-2, and -5/-2 == 5/2.
So isProperFraction(-5, 2) should also return false because -5/2 is not a proper fraction. (Currently your function return true)

Hint: we can compare the absolute value of both parameters instead.

Copy link
Author

Choose a reason for hiding this comment

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

fixed the logic to handle division by zero and simplify return statement to correct the issues

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function isProperFraction(numerator, denominator) {
if (numerator < denominator) return true;
else return false; // returns false if numerator is not less than denominator
if (denominator === 0) return false; // avoid division by zero
return Math.abs(numerator) < Math.abs(denominator);
Comment on lines +2 to +3
Copy link
Contributor

Choose a reason for hiding this comment

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

The condition at line 3 could also take case of cases where denominator is 0.

}

module.exports = isProperFraction;