-
-
Notifications
You must be signed in to change notification settings - Fork 195
London | ITP-May-2025 | Surafel Workneh| Sprint-3 #637
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
…add tests for zero numerator and denominator
…, and invalid inputs with corresponding tests
…roper angle classification with consolelog
…larity and readability
…s for numerator and denominator, ensuring proper fraction validation
… and add test cases
…ive integer counts
…clarity on loop mechanics
Sprint-1/1-key-exercises/3-paths.js
Outdated
filePath.slice(0, lastSlashIndex); | ||
|
||
filePath |
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.
Hi Surafel,I noticed filePath, lastSlashIndex, and base are used without being declared earlier in the code. You’ll need to define those variables before using them so the rest of your logic works correctly.
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 need to clean this code which shouldn’t be in sprint-3 at the first. so I will correct and push in sprint-1
// ====> write your test here, and then add a line to pass the test in the function above |
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.
Hi Surafel, good work on this. Just check that your function returns something for angles like 360 or any number outside 0 to 360. Right now, it doesn’t handle those cases.
@@ -8,7 +8,8 @@ | |||
// write one test at a time, and make it pass, build your solution up methodically | |||
|
|||
function isProperFraction(numerator, denominator) { | |||
if (numerator < denominator) return true; | |||
// if (numerator < denominator) return true; it will not work for negative numbers |
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.
your function should also check if the denominator is zero. If it is, the function should return false because a fraction cannot have a zero as the denominator. Try adding that check. Keep going, you are doing well!
const rank = card.slice(0, -1); // Extract rank (everything except the last character) | ||
if (rank === "A") return 11; // handle Ace as 11 | ||
if (["K", "Q", "J"].includes(rank)) return 10; // handle face cards as 10 | ||
const numerincRank = parseInt(rank); //Handle number cards 2–9 |
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.
There's a typo in numerincRank , it should be numericRank.
expect(count).toEqual(0); | ||
}); | ||
|
||
module.exports = countChar; |
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.
"module.exports = countChar;"
This line should not be in the test file. It is only needed in the main function file where the function is defined.
@@ -9,5 +9,6 @@ const getOrdinalNumber = require("./get-ordinal-number"); | |||
// Then the function should return "1st" | |||
|
|||
test("should return '1st' for 1", () => { | |||
expect(getOrdinalNumber(1)).toEqual("1st"); | |||
}); | |||
expect(getOrdinalNumber(1)).toEqual("1st"); |
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.
Your test is almost correct, but it’s missing the required import of the getOrdinalNumber function
// case: Negative Count: | ||
// Given a target string str and a negative integer count, | ||
// When the repeat function is called with these inputs, | ||
// Then it should throw an error or return an appropriate error message, as negative counts are not valid. | ||
console.log(repeat("hello", -3)); // Expected: "Error: Count must be a non-negative integer" |
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 job testing count values like 1, 0, and negatives. Try using test() and expect() instead of console.log for proper Jest tests.
expect(result).toEqual(true); | ||
}); | ||
expect(result).toEqual(true); |
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 start! You can remove the extra require and expect lines. Also try adding tests for other rules like missing symbols or reused passwords.
cleaning the comments of sprint-1 works on sprint-3
spelling correcetion
add condition to heck if denominator is zero
cleaning code line
No description provided.