|
1 | | -// This statement loads the isProperFraction function you wrote in the implement directory. |
2 | | -// We will use the same function, but write tests for it using Jest in this file. |
3 | 1 | const isProperFraction = require("../implement/2-is-proper-fraction"); |
4 | 2 |
|
5 | 3 | // denominator is zero |
6 | 4 | test("should return false when denominator is zero", () => { |
7 | | - expect(isProperFraction(1, 0)).toEqual(false); |
| 5 | + expect(isProperFraction(1, 0)).toBe(false); |
8 | 6 | }); |
9 | 7 |
|
10 | | -// proper fraction (numerator < denominator) |
| 8 | +// proper fraction |
11 | 9 | test("should return true when numerator < denominator", () => { |
12 | | - expect(isProperFraction(1, 2)).toEqual(true); |
| 10 | + expect(isProperFraction(1, 2)).toBe(true); |
13 | 11 | }); |
14 | 12 |
|
15 | | -// improper fraction (numerator > denominator) |
| 13 | +// improper fraction |
16 | 14 | test("should return false when numerator > denominator", () => { |
17 | | - expect(isProperFraction(5, 3)).toEqual(false); |
| 15 | + expect(isProperFraction(5, 3)).toBe(false); |
18 | 16 | }); |
19 | 17 |
|
20 | 18 | // equal numbers |
21 | 19 | test("should return false when numerator === denominator", () => { |
22 | | - expect(isProperFraction(4, 4)).toEqual(false); |
| 20 | + expect(isProperFraction(4, 4)).toBe(false); |
23 | 21 | }); |
24 | 22 |
|
25 | 23 | // numerator is zero |
26 | 24 | test("should return true when numerator is zero and denominator is positive", () => { |
27 | | - expect(isProperFraction(0, 5)).toEqual(true); |
| 25 | + expect(isProperFraction(0, 5)).toBe(true); |
28 | 26 | }); |
29 | 27 |
|
30 | 28 | // negative numerator |
31 | 29 | test("should return false when numerator is negative", () => { |
32 | | - expect(isProperFraction(-2, 4)).toEqual(false); |
| 30 | + expect(isProperFraction(-2, 4)).toBe(false); |
33 | 31 | }); |
34 | 32 |
|
35 | 33 | // negative denominator |
36 | 34 | test("should return false when denominator is negative", () => { |
37 | | - expect(isProperFraction(5, -4)).toEqual(false); |
| 35 | + expect(isProperFraction(5, -4)).toBe(false); |
38 | 36 | }); |
39 | 37 |
|
40 | 38 | // both negative |
41 | 39 | test("should return false when both numerator and denominator are negative", () => { |
42 | | - expect(isProperFraction(-3, -5)).toEqual(false); |
| 40 | + expect(isProperFraction(-3, -5)).toBe(false); |
43 | 41 | }); |
0 commit comments