Skip to content

Commit 44c463c

Browse files
added tests
1 parent 73862c5 commit 44c463c

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ console.log(isProperFraction(2, 2));
4444
console.log(isProperFraction(2, 1));
4545
console.log(isProperFraction(0, 2));
4646
console.log(isProperFraction(1, 0));
47-
console.log(isProperFraction(0, 0));
47+
console.log(isProperFraction(0, 0));

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
@@ -2,9 +2,27 @@
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.
6-
75
// Special case: numerator is zero
86
test(`should return false when denominator is zero`, () => {
97
expect(isProperFraction(1, 0)).toEqual(false);
108
});
9+
10+
test(`should return false when denominator is zero`, () => {
11+
expect(isProperFraction(1, 2)).toEqual(true);
12+
});
13+
14+
test(`should return false when denominator is zero`, () => {
15+
expect(isProperFraction(2, 2)).toEqual(false);
16+
});
17+
18+
test(`should return false when denominator is zero`, () => {
19+
expect(isProperFraction(2, 1)).toEqual(false);
20+
});
21+
22+
test(`should return false when denominator is zero`, () => {
23+
expect(isProperFraction(0, 0)).toEqual(false);
24+
});
25+
26+
test(`should return false when denominator is zero`, () => {
27+
expect(isProperFraction(0, 1)).toEqual(true);
28+
});

0 commit comments

Comments
 (0)