Skip to content

Commit 2ce1603

Browse files
Complete isProperFraction test coverage
1 parent 161e5a5 commit 2ce1603

2 files changed

Lines changed: 24 additions & 36 deletions

File tree

‎implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js‎

Lines changed: 23 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,10 @@ test("Returns true for a basic proper fraction", () => {
1111
assert.equal(isProperFraction(1, 2), true);
1212
});
1313

14-
test("Returns true for 2/8", () => {
15-
assert.equal(isProperFraction(2, 8), true);
16-
});
17-
1814
test("Returns true when the numerator is zero and denominator is positive", () => {
1915
assert.equal(isProperFraction(0, 1), true);
2016
});
2117

22-
test("Returns true for 5/8", () => {
23-
assert.equal(isProperFraction(5, 8), true);
24-
});
25-
26-
test("Returns true for 8/9", () => {
27-
assert.equal(isProperFraction(8, 9), true);
28-
});
29-
30-
test("Returns true for another proper fraction with a smaller numerator", () => {
31-
assert.equal(isProperFraction(2, 4), true);
32-
});
33-
3418
test("Returns true when both numerator and denominator is negative", () => {
3519
assert.equal(isProperFraction(-1, -2), true);
3620
});
@@ -43,38 +27,42 @@ test("Returns true when the numerator is negative and the denominator is positiv
4327
assert.equal(isProperFraction(-1, 2), true);
4428
});
4529

46-
test("Returns false when the numerator is greater than the denominator", () => {
47-
assert.equal(isProperFraction(9, 8), false);
48-
});
49-
5030
test("Returns false when numerator is negative and denominator is zero", () => {
5131
assert.equal(isProperFraction(-1, 0), false);
5232
});
5333

54-
test("Returns false for 4/2", () => {
55-
assert.equal(isProperFraction(4, 2), false);
34+
test("Returns false for 15/14", () => {
35+
assert.equal(isProperFraction(15, 14), false);
5636
});
5737

58-
test("Returns false for 5/3", () => {
59-
assert.equal(isProperFraction(5, 3), false);
38+
test("Returns false when numerator equals denominator", () => {
39+
assert.equal(isProperFraction(4, 4), false);
6040
});
6141

62-
test("Returns false for 6/4", () => {
63-
assert.equal(isProperFraction(6, 4), false);
42+
test("Returns false when numerator is positive and denominator is zero", () => {
43+
assert.equal(isProperFraction(1, 0), false);
6444
});
6545

66-
test("Returns false for 7/1", () => {
67-
assert.equal(isProperFraction(7, 1), false);
46+
test("Returns false when both numerator and denominator are zero", () => {
47+
assert.equal(isProperFraction(0, 0), false);
6848
});
6949

70-
test("Returns false for 15/14", () => {
71-
assert.equal(isProperFraction(15, 14), false);
50+
test("Returns true when numerator is zero and denominator is negative", () => {
51+
assert.equal(isProperFraction(0, -2), true);
7252
});
7353

74-
test("Returns false when numerator equals denominator", () => {
75-
assert.equal(isProperFraction(4, 4), false);
54+
test("Returns false when positive numerator has greater magnitude than negative denominator", () => {
55+
assert.equal(isProperFraction(3, -2), false);
7656
});
7757

78-
test("Returns false when numerator is positive and denominator is zero", () => {
79-
assert.equal(isProperFraction(1,0), false);
80-
})
58+
test("Returns false when negative numerator has greater magnitude than positive denominator", () => {
59+
assert.equal(isProperFraction(-3, 2), false);
60+
});
61+
62+
test("Returns false when both numbers are negative and numerator has greater magnitude", () => {
63+
assert.equal(isProperFraction(-3, -2), false);
64+
});
65+
66+
test("Returns false when numerator and denominator are equal negative numbers", () => {
67+
assert.equal(isProperFraction(-4, -4), false);
68+
});

‎implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ test("Return true when numerator is zero and denominator is negative", () => {
4444
expect(isProperFraction(0, -2)).toEqual(true);
4545
});
4646

47-
test("Returns false when negative numerator has greater magnitude than positive denominator", () => {
47+
test("Returns false when positive numerator has greater magnitude than negative denominator", () => {
4848
expect(isProperFraction(3, -2)).toEqual(false);
4949
});
5050

0 commit comments

Comments
 (0)