Repository navigation
London | 26-ITP-Sep |Shirin Panahian | Sprint 2 | Implement and rewrite tests - #1699
shirinpanahian wants to merge 19 commits into
Conversation
| expect(() => getAngleType(" ")).toThrow("Input must be a number"); | ||
| expect(() => getAngleType("Shirin")).toThrow("Input must be a number"); | ||
| expect(() => getAngleType("*123")).toThrow("Input must be a number"); | ||
| }); |
There was a problem hiding this comment.
According to the spec defined in 1-get-angle-type.js, the function only needs to handle arguments of type number, and any number that cannot be classified as one of the above named angles are invalid angles.
Could you update this test and the function implementation accordingly?
There was a problem hiding this comment.
I've updated the function to handle numeric inputs and throw an "Invalid angle" error for numbers that don't match any of the named angle types. I've also updated the tests to cover the valid angle types and invalid numeric values.
| test(`should return true when denominator is negative and bigger`, () => { | ||
| expect(isProperFraction(2, -5)).toEqual(true); | ||
| }); | ||
|
|
||
| test(`should return false when denominator is negative ans smaller`, () => { | ||
| expect(isProperFraction(4, -3)).toEqual(false); | ||
| }); | ||
|
|
||
| test(`should return correct answer when both is negative`, () => { | ||
| expect(isProperFraction(-4, -3)).toEqual(false); | ||
| expect(isProperFraction(-1, -3)).toEqual(true); | ||
| }); |
There was a problem hiding this comment.
Note: Could consider using pseudo-code or math notations like abs(...) or | ... | in the descriptions to more
concisely describe the conditions (the "when" part).
There was a problem hiding this comment.
Thanks for the suggestion! I've updated the test descriptions to use absolute-value notation, making the conditions more concise and easier to understand.
| test(`Should return number for Valid digit card`, () => { | ||
| expect(getCardValue("3♠")).toEqual(3); | ||
| }); |
There was a problem hiding this comment.
-
Note: We call this kind of cards , number cards.
-
Could consider testing more samples in each of the test category.
There was a problem hiding this comment.
I've added more examples to each test category to improve test coverage.
|
Changes look good. Well done! |
Learners, PR Template
Self checklist
Task code
CYF-1059
Changelist
I built code while writing tests for the code using node and jest to test.