Skip to content

Commit f8f268c

Browse files
committed
added more test cases withing each test()
1 parent 7e35093 commit f8f268c

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

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

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,37 @@ const isProperFraction = require("../implement/2-is-proper-fraction");
44

55
test("should return true for a proper fraction", () => {
66
expect(isProperFraction(2, 3)).toEqual(true);
7+
expect(isProperFraction(3, 2)).toEqual(false);
8+
expect(isProperFraction(5, 8)).toEqual(true);
9+
expect(isProperFraction(8, 5)).toEqual(false);
10+
expect(isProperFraction(1, 4)).toEqual(true);
11+
expect(isProperFraction(4, 1)).toEqual(false);
12+
expect(isProperFraction(1, 4)).toEqual(true);
713
});
814

915
// Case 2: Identify Improper Fractions:
1016
test("should return false for an improper Fractions", () => {
1117
expect(isProperFraction(9, 4)).toEqual(false);
18+
expect(isProperFraction(4, 9)).toEqual(true);
19+
expect(isProperFraction(7, 3)).toEqual(false);
20+
expect(isProperFraction(3, 7)).toEqual(true);
21+
expect(isProperFraction(10, 2)).toEqual(false);
22+
expect(isProperFraction(2, 10)).toEqual(true);
1223
});
1324

1425
// Case 3: Identify Negative Fractions:
15-
test("should return true for a negative Fractions", () => {
16-
expect(isProperFraction(-6, 4)).toEqual(true);
26+
test("should return false for a negative Fractions", () => {
27+
expect(isProperFraction(-6, 4)).toEqual(false);
28+
expect(isProperFraction(-4, 6)).toEqual(true);
29+
expect(isProperFraction(6, -4)).toEqual(false);
30+
expect(isProperFraction(4, -6)).toEqual(true);
31+
expect(isProperFraction(-6, -4)).toEqual(false);
32+
expect(isProperFraction(-4, -6)).toEqual(true);
1733
});
1834

1935
// Case 4: Identify Equal Numerator and Denominator:
2036
test("should return false for an equal Fractions", () => {
2137
expect(isProperFraction(7, 7)).toEqual(false);
38+
expect(isProperFraction(10, 10)).toEqual(false);
39+
expect(isProperFraction(1, 1)).toEqual(false);
2240
});

0 commit comments

Comments
 (0)