Skip to content

Commit 5eb49c7

Browse files
committed
updated test case for proper fraction function
1 parent 4b897f5 commit 5eb49c7

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,27 @@ test(`should return false when denominator is zero`, () => {
1010
});
1111

1212
// Normal case:
13-
test(`should return false when denominator is zero`, () => {
13+
test(`should return true in normal scenario`, () => {
1414
expect(isProperFraction(5, 10)).toEqual(true);
1515
});
1616
// Boundary Value
17-
test(`should return false when denominator is zero`, () => {
18-
expect(isProperFraction(1, 0)).toEqual(false);
17+
test(`should return false when numerator is 0`, () => {
18+
expect(isProperFraction(0, 5)).toEqual(false);
1919
});
2020
// Improper Fraction
21-
test(`should return false when denominator is zero`, () => {
22-
expect(isProperFraction(1, 1)).toEqual(false);
21+
test(`should return false when numerator is greater than denominator`, () => {
22+
expect(isProperFraction(8, 3)).toEqual(false);
2323
});
2424
// Negative Value
25-
test(`should return false when denominator is zero`, () => {
25+
test(`should return false when numerator is negative`, () => {
2626
expect(isProperFraction(-3, 8)).toEqual(false);
2727

2828
});
2929
// Very Small
30-
test(`should return false when denominator is zero`, () => {
30+
test(`should return true with very small values`, () => {
3131
expect(isProperFraction(0.0001, 999999)).toEqual(true);
3232
});
3333
// very large
34-
test(`should return false when denominator is zero`, () => {
34+
test(`should return false with very large`, () => {
3535
expect(isProperFraction(999999, 0.0001)).toEqual(false);
3636
});

Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// We will use the same function, but write tests for it using Jest in this file.
33
const getCardValue = require("../implement/3-get-card-value");
44

5-
// TODO: Write tests in Jest syntax to cover all possible outcomes.
5+
// Write tests in Jest syntax to cover all possible outcomes.
66

77
// Case 1: Ace (A)
88
test(`Should return 11 when given an ace card`, () => {
@@ -11,8 +11,17 @@ test(`Should return 11 when given an ace card`, () => {
1111

1212
// Suggestion: Group the remaining test data into these categories:
1313
// Number Cards (2-10)
14+
test(`Should return 11 when given an ace card`, () => {
15+
expect(getCardValue("A♠")).toEqual(11);
16+
});
1417
// Face Cards (J, Q, K)
18+
test(`Should return 11 when given an ace card`, () => {
19+
expect(getCardValue("A♠")).toEqual(11);
20+
});
1521
// Invalid Cards
22+
test(`Should return 11 when given an ace card`, () => {
23+
expect(getCardValue("A♠")).toEqual(11);
24+
});
1625

1726
// To learn how to test whether a function throws an error as expected in Jest,
1827
// please refer to the Jest documentation:

0 commit comments

Comments
 (0)