Skip to content

Commit 362f624

Browse files
author
Pretty Taruvinga
committed
Improve isProperFraction Jest tests
- Added tests for proper fractions using abs(numerator) < abs(denominator) - Added tests for improper fractions using abs(numerator) >= abs(denominator) - Covered positive, negative, and zero cases - Added test for denominator equal to zero
1 parent 71445dc commit 362f624

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,15 @@ test("should return true when numerator is zero and denominator is positive", ()
1616

1717
// Proper fractions
1818
test("should return true when abs(numerator) < abs(denominator)", () => {
19-
expect(isProperFraction(1, 2)).toEqual(true);
20-
expect(isProperFraction(-1, 2)).toEqual(true);
21-
expect(isProperFraction(1, -2)).toEqual(true);
22-
expect(isProperFraction(-1, -2)).toEqual(true);
19+
expect(isProperFraction(1, 2)).toBe(true);
20+
expect(isProperFraction(-1, 2)).toBe(true);
21+
expect(isProperFraction(1, -2)).toBe(true);
22+
expect(isProperFraction(-1, -2)).toBe(true);
2323
});
2424

2525
// Improper fractions
26-
test("should return false when numerator is equal to denominator", () => {
27-
expect(isProperFraction(2, 2)).toEqual(false);
28-
});
29-
30-
test("should return false when numerator is greater than denominator", () => {
31-
expect(isProperFraction(3, 2)).toEqual(false);
26+
test("should return false when abs(numerator) >= abs(denominator)", () => {
27+
expect(isProperFraction(2, 2)).toBe(false);
28+
expect(isProperFraction(3, 2)).toBe(false);
29+
expect(isProperFraction(-3, 2)).toBe(false);
3230
});

0 commit comments

Comments
 (0)