West Midlands | 26-Jan-ITP | Fida H Ali Zada | Sprint 3 | Implement and Rewrite Tests#1129
Open
alizada-dev wants to merge 12 commits intoCodeYourFuture:mainfrom
Open
Conversation
cjyuan
reviewed
Mar 11, 2026
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/implement/3-get-card-value.js
Outdated
Show resolved
Hide resolved
| // https://jestjs.io/docs/expect#tothrowerror | ||
|
|
||
| // Number Cards (2-10) | ||
| test(`should return the number (numeric value)`, () => { |
Contributor
There was a problem hiding this comment.
How about ... the numeric value of number cards?
cjyuan
reviewed
Mar 11, 2026
Comment on lines
+12
to
+38
| test(`should return true when (numerator < denominator)`, () => { | ||
| expect(isProperFraction(0, 1)).toEqual(true); | ||
| }) | ||
|
|
||
| test(`should return true when (numerator < denominator)`, () => { | ||
| expect(isProperFraction(-6, -3)).toEqual(true); | ||
| }) | ||
|
|
||
| test(`should return true when (numerator < denominator)`, () => { | ||
| expect(isProperFraction(1, 2)).toEqual(true); | ||
| }) | ||
|
|
||
| test(`should return false when (numerator > denominator)`, () => { | ||
| expect(isProperFraction(2, 1)).toEqual(false); | ||
| }) | ||
|
|
||
| test(`should return false when (numerator == denominator)`, () => { | ||
| expect(isProperFraction(0, 0)).toEqual(false); | ||
| }) | ||
|
|
||
| test(`should return false when (numerator > denominator)`, () => { | ||
| expect(isProperFraction(-1, -2)).toEqual(false); | ||
| }) | ||
|
|
||
| test(`should return false when (numerator > denominator)`, () => { | ||
| expect(isProperFraction(0, -1)).toEqual(false); | ||
| }) No newline at end of file |
Contributor
There was a problem hiding this comment.
Since you have updated the function, can you also update this test script?
You can use notations such as | ... | or abs( ... ) in the test description, and can probably group some of the test cases into the same group.
Author
There was a problem hiding this comment.
Ah, got it, sir! I totally forgot the test cases. Now I fixed them.
cjyuan
reviewed
Mar 12, 2026
Comment on lines
+23
to
+25
| test(`should return false when (numerator == denominator)`, () => { | ||
| expect(isProperFraction(0, 0)).toEqual(false); | ||
| }) No newline at end of file |
Contributor
There was a problem hiding this comment.
This test would have missed detecting a bug in this implementation:
function isProperFraction(numarator, denominator) {
if (denominator == 0) return false;
return Math.abs(numarator) <= Math.abs(denominator);
}| expect(isProperFraction(2, 1)).toEqual(false); | ||
| expect(isProperFraction(-2, -1)).toEqual(false); | ||
| }) | ||
|
|
Contributor
There was a problem hiding this comment.
You have more comprehensive test data in Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Learners, PR Template
Self checklist
Changelist
Completed the Sprint 3 Implement and Rewrite Tests. I hope to see comments on my work so I can improve. Thank you.