Skip to content

Commit 09fe227

Browse files
committed
all jest tests pass in 2-is-proper-fraction.js
1 parent 62aab55 commit 09fe227

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

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

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,32 @@
22
// We will use the same function, but write tests for it using Jest in this file.
33
const isProperFraction = require("../implement/2-is-proper-fraction");
44

5-
// TODO: Write tests in Jest syntax to cover all combinations of positives, negatives, zeros, and other categories.
65

76
// Special case: numerator is zero
87
test(`should return false when denominator is zero`, () => {
9-
expect(isProperFraction(1, 0)).toEqual(false);
8+
expect(isProperFraction(1,2 )).toEqual(true);
9+
expect(isProperFraction(2,1)).toEqual(false);
10+
expect(isProperFraction(5,5)).toEqual(false);
11+
expect(isProperFraction(0,5)).toEqual(true);
12+
expect(isProperFraction(5,0)).toEqual(false);
13+
expect(isProperFraction(0,0)).toEqual(false);
14+
expect(isProperFraction(-1,2)).toEqual(true);
15+
expect(isProperFraction(1,-2)).toEqual(false);
16+
expect(isProperFraction(-2,-1)).toEqual(true);
17+
expect(isProperFraction(-1,-2)).toEqual(false);
18+
expect(isProperFraction(0.5,1)).toEqual(true);
19+
expect(isProperFraction(1.5,1)).toEqual(false);
20+
expect(isProperFraction(Infinity,2)).toEqual(false);
21+
expect(isProperFraction(2,Infinity)).toEqual(false);
22+
expect(isProperFraction(NaN,2)).toEqual(false)
23+
expect(isProperFraction(2,NaN)).toEqual(false);
24+
expect(isProperFraction(999999999, 1000000000)).toEqual(true)
25+
26+
27+
28+
29+
30+
31+
32+
1033
});

0 commit comments

Comments
 (0)