-
-
Notifications
You must be signed in to change notification settings - Fork 272
West Midlands | ITP-Sept-2025 | Ali Naru | Sprint 3 | Coursework/sprint 3 implement and rewrite #845
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?
West Midlands | ITP-Sept-2025 | Ali Naru | Sprint 3 | Coursework/sprint 3 implement and rewrite #845
Changes from 8 commits
6082322
2e97a22
d75ebfb
878d49e
6032ba9
cc9f8f2
6a9a7cd
ccd4e00
9ddec99
484ee5b
b489194
5c0c597
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,12 +2,27 @@ | |
| // We will use the same function, but write tests for it using Jest in this file. | ||
| const isProperFraction = require("../implement/2-is-proper-fraction"); | ||
|
|
||
| test("should return true for a proper fraction", () => { | ||
| test("should return true for a proper fraction (numerator < denominator)", () => { | ||
| expect(isProperFraction(2, 3)).toEqual(true); | ||
| }); | ||
|
|
||
| // Case 2: Identify Improper Fractions: | ||
| // When the numerator is greater than or equal to the denominator, | ||
| // Then the function should return false | ||
| test("should return false for an improper fraction (numerator > denominator)", () => { | ||
| expect(isProperFraction(5, 2)).toEqual(false); | ||
| }); | ||
|
|
||
| // Case 3: Identify Negative Fractions: | ||
| // When the numerator is negative but absolute value < denominator, | ||
| // Then the function should return true | ||
| test("should return true for a negative proper fraction (|numerator| < denominator)", () => { | ||
| expect(isProperFraction(-4, 7)).toEqual(true); | ||
| }); | ||
|
Comment on lines
+19
to
+23
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To make the tests cover all possible categories, you can consider including a test for negative improper fractions.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I’ve updated the implementation based on feedback to make it more robust and complete. For |
||
|
|
||
| // Case 4: Identify Equal Numerator and Denominator: | ||
| // When the numerator is equal to the denominator, | ||
| // Then the function should return false | ||
| test("should return false when numerator equals denominator", () => { | ||
| expect(isProperFraction(3, 3)).toEqual(false); | ||
| }); | ||
Uh oh!
There was an error while loading. Please reload this page.