From b1f57bf0719e5661b60f1b2399f1b4179da46616 Mon Sep 17 00:00:00 2001 From: abduhasen Date: Tue, 3 Mar 2026 01:35:57 +0000 Subject: [PATCH 1/6] implement and rewriting tests complete --- .../implement/1-get-angle-type.js | 34 ++++++++++++++++++ .../implement/2-is-proper-fraction.js | 9 ++++- .../implement/3-get-card-value.js | 16 ++++++++- .../1-get-angle-type.test.js | 35 ++++++++++++++++--- .../2-is-proper-fraction.test.js | 12 ++++++- .../3-get-card-value.test.js | 22 ++++++++++-- 6 files changed, 118 insertions(+), 10 deletions(-) diff --git a/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js b/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js index 9e05a871e2..1c585facee 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js +++ b/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js @@ -16,6 +16,12 @@ function getAngleType(angle) { // TODO: Implement this function + if (angle > 0 && angle < 90) return "Acute angle"; + else if (angle === 90) return "Right angle"; + else if (90 < angle && angle < 180) return "Obtuse angle"; + else if (angle === 180) return "Straight angle"; + else if (180 < angle && angle < 360) return "Reflex angle"; + else return "Invalid angle"; } // The line below allows us to load the getAngleType function into tests in other files. @@ -35,3 +41,31 @@ function assertEquals(actualOutput, targetOutput) { // Example: Identify Right Angles const right = getAngleType(90); assertEquals(right, "Right angle"); +let acute = getAngleType(1); +assertEquals(acute, "Acute angle"); +acute = getAngleType(45); +assertEquals(acute, "Acute angle"); +acute = getAngleType(89); +assertEquals(acute, "Acute angle"); +let obtuse = getAngleType(91); +assertEquals(obtuse, "Obtuse angle"); +obtuse = getAngleType(100); +assertEquals(obtuse, "Obtuse angle"); +obtuse = getAngleType(179); +assertEquals(obtuse, "Obtuse angle"); +const straight = getAngleType(180); +assertEquals(straight, "Straight angle"); +let reflex = getAngleType(200); +assertEquals(reflex, "Reflex angle"); +reflex = getAngleType(243); +assertEquals(reflex, "Reflex angle"); +reflex = getAngleType(359); +assertEquals(reflex, "Reflex angle"); +let invalid = getAngleType(-11); +assertEquals(invalid, "Invalid angle"); +invalid = getAngleType(0); +assertEquals(invalid, "Invalid angle"); +invalid = getAngleType(360); +assertEquals(invalid, "Invalid angle"); +invalid = getAngleType(371); +assertEquals(invalid, "Invalid angle"); diff --git a/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js b/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js index 970cb9b641..c44147e38e 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js +++ b/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js @@ -12,8 +12,9 @@ function isProperFraction(numerator, denominator) { // TODO: Implement this function + if (Math.abs(numerator) < Math.abs(denominator)) return true; + else return false; } - // The line below allows us to load the isProperFraction function into tests in other files. // This will be useful in the "rewrite tests with jest" step. module.exports = isProperFraction; @@ -31,3 +32,9 @@ function assertEquals(actualOutput, targetOutput) { // Example: 1/2 is a proper fraction assertEquals(isProperFraction(1, 2), true); +assertEquals(isProperFraction(7, 4), false); +assertEquals(isProperFraction(-8, 5), false); +assertEquals(isProperFraction(9, 10), true); +assertEquals(isProperFraction(-3, -6), true); +assertEquals(isProperFraction(15, 11), false); +assertEquals(isProperFraction(-17, -24), true); diff --git a/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js b/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js index c7559e787e..9cf7380c00 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js +++ b/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js @@ -20,11 +20,25 @@ // Acceptance criteria: // After you have implemented the function, write tests to cover all the cases, and // execute the code to ensure all tests pass. - function getCardValue(card) { // TODO: Implement this function + if (typeof card !== "string") { + throw new Error("Invalid card"); + } + const validSuits = ["♠", "♥", "♦", "♣"]; + const suit = card.slice(-1); + const rank = card.slice(0, -1); + if (!validSuits.includes(suit)) { + throw new Error("Invalid card"); + } else if (rank === "A") return 11; + else if (["J", "Q", "K"].includes(rank)) return 10; + const number = Number(rank); + if (number >= 2 && number <= 10) return number; + throw new Error("Invalid card"); } +module.exports = getCardValue; + // The line below allows us to load the getCardValue function into tests in other files. // This will be useful in the "rewrite tests with jest" step. module.exports = getCardValue; diff --git a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js index d777f348d3..4ca3eb87a5 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js +++ b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js @@ -6,15 +6,40 @@ const getAngleType = require("../implement/1-get-angle-type"); // including boundary and invalid cases. // Case 1: Acute angles -test(`should return "Acute angle" when (0 < angle < 90)`, () => { +test(`should return "Acute angles" when (0 < angle < 90)`, () => { // Test various acute angles, including boundary cases - expect(getAngleType(1)).toEqual("Acute angle"); - expect(getAngleType(45)).toEqual("Acute angle"); - expect(getAngleType(89)).toEqual("Acute angle"); + expect(getAngleType(1)).toBe("Acute angle"); + expect(getAngleType(45)).toBe("Acute angle"); + expect(getAngleType(89)).toBe("Acute angle"); }); - // Case 2: Right angle +test(`should return "Right angle" when (angle === 90)`, () => { + // Test various acute angles, including boundary cases + expect(getAngleType(90)).toBe("Right angle"); +}); // Case 3: Obtuse angles +test(`should return "Obtuse angle" when (90 < angle < 180)`, () => { + // Test various acute angles, including boundary cases + expect(getAngleType(97)).toBe("Obtuse angle"); + expect(getAngleType(129)).toBe("Obtuse angle"); + expect(getAngleType(165)).toBe("Obtuse angle"); +}); // Case 4: Straight angle +test(`should return "Straight angle" when (angle ==180)`, () => { + // Test various acute angles, including boundary cases + expect(getAngleType(180)).toBe("Straight angle"); +}); // Case 5: Reflex angles +test(`should return "Reflex angles" when (180 < angle < 360)`, () => { + // Test various acute angles, including boundary cases + expect(getAngleType(191)).toBe("Reflex angle"); + expect(getAngleType(250)).toBe("Reflex angle"); + expect(getAngleType(317)).toBe("Reflex angle"); +}); // Case 6: Invalid angles +test(`should return "Invalid angles" when (angle >= 360 or angle<= 0 )`, () => { + // Test various acute angles, including boundary cases + expect(getAngleType(0)).toBe("Invalid angle"); + expect(getAngleType(-45)).toBe("Invalid angle"); + expect(getAngleType(370)).toBe("Invalid angle"); +}); diff --git a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js index 7f087b2ba1..72fb4215aa 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js +++ b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js @@ -3,8 +3,18 @@ const isProperFraction = require("../implement/2-is-proper-fraction"); // TODO: Write tests in Jest syntax to cover all combinations of positives, negatives, zeros, and other categories. - // Special case: numerator is zero test(`should return false when denominator is zero`, () => { expect(isProperFraction(1, 0)).toEqual(false); + expect(isProperFraction(0, 1)).toEqual(true); + expect(isProperFraction(0, -1)).toEqual(true); + expect(isProperFraction(18, 1)).toEqual(false); + expect(isProperFraction(7, 3)).toEqual(false); + expect(isProperFraction(1, -2)).toEqual(true); + expect(isProperFraction(-15, -9)).toEqual(false); + expect(isProperFraction(-2, -6)).toEqual(true); + expect(isProperFraction(-137, -71)).toEqual(false); + expect(isProperFraction(-100, -189)).toEqual(true); + expect(isProperFraction(27, 5)).toEqual(false); + expect(isProperFraction(-29, 17)).toEqual(false); }); diff --git a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js index cf7f9dae2e..2d89f4f601 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js +++ b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js @@ -8,7 +8,26 @@ const getCardValue = require("../implement/3-get-card-value"); test(`Should return 11 when given an ace card`, () => { expect(getCardValue("A♠")).toEqual(11); }); - +// Case 2: Number Cards (2-10) +test(`Should return the numeric value for number cards`, () => { + expect(getCardValue("2♠")).toEqual(2); + expect(getCardValue("5♥")).toEqual(5); + expect(getCardValue("9♦")).toEqual(9); + expect(getCardValue("10♣")).toEqual(10); +}); +// Case 3: Face Cards (J, Q, K) +test(`Should return 10 for face cards`, () => { + expect(getCardValue("J♠")).toEqual(10); + expect(getCardValue("Q♥")).toEqual(10); + expect(getCardValue("K♦")).toEqual(10); +}); +// Case 4: Invalid Cards +test(`Should throw "Invalid card" for invalid cards`, () => { + expect(() => getCardValue("1♠")).toThrow("Invalid card"); + expect(() => getCardValue("B♠")).toThrow("Invalid card"); + expect(() => getCardValue("A$")).toThrow("Invalid card"); + expect(() => getCardValue("10X")).toThrow("Invalid card"); +}); // Suggestion: Group the remaining test data into these categories: // Number Cards (2-10) // Face Cards (J, Q, K) @@ -17,4 +36,3 @@ test(`Should return 11 when given an ace card`, () => { // To learn how to test whether a function throws an error as expected in Jest, // please refer to the Jest documentation: // https://jestjs.io/docs/expect#tothrowerror - From 239560355901b3788192f08bcf9fb9e92c80376d Mon Sep 17 00:00:00 2001 From: abduhasen Date: Wed, 11 Mar 2026 20:45:09 +0000 Subject: [PATCH 2/6] fixing code based on mentor feedback --- .../implement/3-get-card-value.js | 33 ++++++++++++++----- .../1-get-angle-type.test.js | 1 + .../2-is-proper-fraction.test.js | 25 +++++++++----- .../3-get-card-value.test.js | 3 ++ 4 files changed, 45 insertions(+), 17 deletions(-) diff --git a/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js b/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js index 9cf7380c00..72bb51847a 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js +++ b/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js @@ -22,18 +22,35 @@ // execute the code to ensure all tests pass. function getCardValue(card) { // TODO: Implement this function - if (typeof card !== "string") { + if (!card || typeof card !== "string") { throw new Error("Invalid card"); } + // const validSuits = ["♠", "♥", "♦", "♣"]; - const suit = card.slice(-1); - const rank = card.slice(0, -1); + const suit = card.slice(-1); //takes the last character of the string. + const rank = card.slice(0, -1); //takes everything except the last character. + if (!validSuits.includes(suit)) { - throw new Error("Invalid card"); - } else if (rank === "A") return 11; - else if (["J", "Q", "K"].includes(rank)) return 10; - const number = Number(rank); - if (number >= 2 && number <= 10) return number; + throw new Error("Invalid card"); // This if statement checks the suit is valid with the Array of suit we assigned + } + // Based on the question i get form mentor i changed the function if statement for better experience of the code. + const cardValues = { + A: 11, + J: 10, + Q: 10, + K: 10, + 2: 2, + 3: 3, + 4: 4, + 5: 5, + 6: 6, + 7: 7, + 8: 8, + 9: 9, + 10: 10, + }; // This is java script object that act as like lookup table for the valid card value input. + + if (cardValues[rank] !== undefined) return cardValues[rank]; throw new Error("Invalid card"); } diff --git a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js index 4ca3eb87a5..b06ce62609 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js +++ b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js @@ -42,4 +42,5 @@ test(`should return "Invalid angles" when (angle >= 360 or angle<= 0 )`, () => { expect(getAngleType(0)).toBe("Invalid angle"); expect(getAngleType(-45)).toBe("Invalid angle"); expect(getAngleType(370)).toBe("Invalid angle"); + expect(getAngleType(360)).toBe("Invalid angle"); }); diff --git a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js index 72fb4215aa..3bdc841d8a 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js +++ b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js @@ -5,16 +5,23 @@ const isProperFraction = require("../implement/2-is-proper-fraction"); // TODO: Write tests in Jest syntax to cover all combinations of positives, negatives, zeros, and other categories. // Special case: numerator is zero test(`should return false when denominator is zero`, () => { - expect(isProperFraction(1, 0)).toEqual(false); - expect(isProperFraction(0, 1)).toEqual(true); + expect(isProperFraction(-11, 0)).toEqual(false); + expect(isProperFraction(0, 0)).toEqual(false); + expect(isProperFraction(7, 0)).toEqual(false); +}); +// It should return false when the numerator > the denominator +test("should return true when numerator is 0", () => { expect(isProperFraction(0, -1)).toEqual(true); - expect(isProperFraction(18, 1)).toEqual(false); - expect(isProperFraction(7, 3)).toEqual(false); - expect(isProperFraction(1, -2)).toEqual(true); - expect(isProperFraction(-15, -9)).toEqual(false); - expect(isProperFraction(-2, -6)).toEqual(true); - expect(isProperFraction(-137, -71)).toEqual(false); - expect(isProperFraction(-100, -189)).toEqual(true); + expect(isProperFraction(0, 3)).toEqual(true); + expect(isProperFraction(0, -2)).toEqual(true); +}); +test("should return true when numerator > denominator", () => { + expect(isProperFraction(-12, -19)).toEqual(true); + expect(isProperFraction(0, 6)).toEqual(true); + expect(isProperFraction(17, -71)).toEqual(true); +}); +test("should return false when numerator < denominator", () => { + expect(isProperFraction(-180, -109)).toEqual(false); expect(isProperFraction(27, 5)).toEqual(false); expect(isProperFraction(-29, 17)).toEqual(false); }); diff --git a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js index 2d89f4f601..b9ec763979 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js +++ b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js @@ -27,6 +27,9 @@ test(`Should throw "Invalid card" for invalid cards`, () => { expect(() => getCardValue("B♠")).toThrow("Invalid card"); expect(() => getCardValue("A$")).toThrow("Invalid card"); expect(() => getCardValue("10X")).toThrow("Invalid card"); + expect(() => getCardValue("0x02♠")).toThrow("Invalid card"); + expect(() => getCardValue("2.1♠")).toThrow("Invalid card"); + expect(() => getCardValue("0002♠")).toThrow("Invalid card"); }); // Suggestion: Group the remaining test data into these categories: // Number Cards (2-10) From ec69eea2f55a37d417d6a24908f68aba0934d20b Mon Sep 17 00:00:00 2001 From: abduhasen Date: Thu, 12 Mar 2026 10:24:45 +0000 Subject: [PATCH 3/6] adding `abs(...) ` notation to indicate the comparison is made on the absolute values of the numerator and the denominator. --- .../rewrite-tests-with-jest/2-is-proper-fraction.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js index 3bdc841d8a..b0b026a1da 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js +++ b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js @@ -15,12 +15,12 @@ test("should return true when numerator is 0", () => { expect(isProperFraction(0, 3)).toEqual(true); expect(isProperFraction(0, -2)).toEqual(true); }); -test("should return true when numerator > denominator", () => { +test("should return true when abs(numerator) > abs(denominator)", () => { expect(isProperFraction(-12, -19)).toEqual(true); expect(isProperFraction(0, 6)).toEqual(true); expect(isProperFraction(17, -71)).toEqual(true); }); -test("should return false when numerator < denominator", () => { +test("should return false when abs(numerator) < abs(denominator)", () => { expect(isProperFraction(-180, -109)).toEqual(false); expect(isProperFraction(27, 5)).toEqual(false); expect(isProperFraction(-29, 17)).toEqual(false); From 9f67b6cb7fe7f0fc4d7b0d8a5ee705a31f8c75d9 Mon Sep 17 00:00:00 2001 From: abduhasen Date: Thu, 12 Mar 2026 20:58:03 +0000 Subject: [PATCH 4/6] fixed the error and add `throw new error` if the denominator is 0 and added test as well --- .../implement/2-is-proper-fraction.js | 4 ++-- .../2-is-proper-fraction.test.js | 21 ++++++++++++------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js b/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js index c44147e38e..e310c150fc 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js +++ b/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js @@ -12,8 +12,8 @@ function isProperFraction(numerator, denominator) { // TODO: Implement this function - if (Math.abs(numerator) < Math.abs(denominator)) return true; - else return false; + if (denominator === 0) throw new Error("Denominator cannot be zero"); + return Math.abs(numerator) < Math.abs(denominator); } // The line below allows us to load the isProperFraction function into tests in other files. // This will be useful in the "rewrite tests with jest" step. diff --git a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js index b0b026a1da..c6e800f55e 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js +++ b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js @@ -4,24 +4,29 @@ const isProperFraction = require("../implement/2-is-proper-fraction"); // TODO: Write tests in Jest syntax to cover all combinations of positives, negatives, zeros, and other categories. // Special case: numerator is zero -test(`should return false when denominator is zero`, () => { - expect(isProperFraction(-11, 0)).toEqual(false); - expect(isProperFraction(0, 0)).toEqual(false); - expect(isProperFraction(7, 0)).toEqual(false); +test("should Throw new error for abs(denominator) == 0", () => { + expect(() => isProperFraction(-11, 0)).toThrow("Denominator cannot be zero"); + expect(() => isProperFraction(0, 0)).toThrow("Denominator cannot be zero"); + expect(() => isProperFraction(7, 0)).toThrow("Denominator cannot be zero"); }); // It should return false when the numerator > the denominator -test("should return true when numerator is 0", () => { +test("should return false when abs(numerator) == 0", () => { expect(isProperFraction(0, -1)).toEqual(true); expect(isProperFraction(0, 3)).toEqual(true); expect(isProperFraction(0, -2)).toEqual(true); }); -test("should return true when abs(numerator) > abs(denominator)", () => { +test("should return true when abs(numerator) < abs(denominator)", () => { expect(isProperFraction(-12, -19)).toEqual(true); - expect(isProperFraction(0, 6)).toEqual(true); + expect(isProperFraction(3, 6)).toEqual(true); expect(isProperFraction(17, -71)).toEqual(true); }); -test("should return false when abs(numerator) < abs(denominator)", () => { +test("should return false when abs(numerator) > abs(denominator)", () => { expect(isProperFraction(-180, -109)).toEqual(false); expect(isProperFraction(27, 5)).toEqual(false); expect(isProperFraction(-29, 17)).toEqual(false); }); +test("should return false when abs(numerator) == abs(denominator)", () => { + expect(isProperFraction(9, 9)).toEqual(false); + expect(isProperFraction(-17, -17)).toEqual(false); + expect(isProperFraction(-15, 15)).toEqual(false); +}); From 969c0763f8969468573272aba4511f5cffe0d174 Mon Sep 17 00:00:00 2001 From: abduhasen Date: Fri, 13 Mar 2026 10:01:29 +0000 Subject: [PATCH 5/6] fixing error on line 12 --- .../rewrite-tests-with-jest/2-is-proper-fraction.test.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js index c6e800f55e..08f7c488c2 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js +++ b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js @@ -9,8 +9,7 @@ test("should Throw new error for abs(denominator) == 0", () => { expect(() => isProperFraction(0, 0)).toThrow("Denominator cannot be zero"); expect(() => isProperFraction(7, 0)).toThrow("Denominator cannot be zero"); }); -// It should return false when the numerator > the denominator -test("should return false when abs(numerator) == 0", () => { +test("should return true when abs(numerator) == 0", () => { expect(isProperFraction(0, -1)).toEqual(true); expect(isProperFraction(0, 3)).toEqual(true); expect(isProperFraction(0, -2)).toEqual(true); From 19b1d130faeceddd7acb08283e52d5c02d6b44dc Mon Sep 17 00:00:00 2001 From: abduhasen Date: Fri, 13 Mar 2026 10:06:57 +0000 Subject: [PATCH 6/6] adding description --- .../rewrite-tests-with-jest/2-is-proper-fraction.test.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js index 08f7c488c2..4b87fda099 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js +++ b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js @@ -9,6 +9,7 @@ test("should Throw new error for abs(denominator) == 0", () => { expect(() => isProperFraction(0, 0)).toThrow("Denominator cannot be zero"); expect(() => isProperFraction(7, 0)).toThrow("Denominator cannot be zero"); }); +// It should return true when the numerator is 0 test("should return true when abs(numerator) == 0", () => { expect(isProperFraction(0, -1)).toEqual(true); expect(isProperFraction(0, 3)).toEqual(true);