From de3258010020226d80b979f6c329639bc0fab642 Mon Sep 17 00:00:00 2001 From: KK Tech Date: Thu, 12 Mar 2026 21:21:16 +0000 Subject: [PATCH 01/10] completed few tasks of Sprint 3 --- .../implement/1-get-angle-type.js | 13 +++++++- .../implement/2-is-proper-fraction.js | 8 ++++- .../implement/3-get-card-value.js | 30 ++++++++++++++++++- package.json | 6 ++-- 4 files changed, 51 insertions(+), 6 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..d7074a7f7a 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 @@ -15,7 +15,18 @@ // execute the code to ensure all tests pass. function getAngleType(angle) { - // TODO: Implement this function + if (angle > 0 && angle < 90) { + return "Acute angle"; + } else if (angle === 90) { + return "Right angle"; + } else if (angle > 90 && angle < 180) { + return "Obtuse angle"; + } else if (angle === 180) { + return "Straight angle"; + } else if (angle > 180 && angle < 360) { + return "Reflex angle"; + } + return "Invalid angle"; } // The line below allows us to load the getAngleType function into tests in other files. 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..a6ddd74dd2 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 @@ -11,9 +11,15 @@ // execute the code to ensure all tests pass. function isProperFraction(numerator, denominator) { - // TODO: Implement this function + if (denominator === 0) { + return false; + } + 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. module.exports = isProperFraction; 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..f44daea95e 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,7 +22,35 @@ // execute the code to ensure all tests pass. function getCardValue(card) { - // TODO: Implement this function + const rank = card.slice(0, -1); + const suit = card.slice(-1); + const validSuits = ["♠", "♥", "♦", "♣"]; + const validRanks = [ + "A", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "10", + "J", + "Q", + "K", + ]; + + if (!validSuits.includes(suit) || !validRanks.includes(rank)) { + throw new Error("Invalid card"); + } + if (rank === "A") { + return 11; + } + if (rank === "J" || rank === "Q" || rank === "K") { + return 10; + } + return parseInt(rank); } // The line below allows us to load the getCardValue function into tests in other files. diff --git a/package.json b/package.json index 0657e22dd8..87d27ab8ff 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "keywords": [], "author": "Code Your Future", "license": "ISC", - "dependencies": { - "jest": "^29.7.0" + "devDependencies": { + "jest": "^30.2.0" } -} \ No newline at end of file +} From d4f7ac16724255f9ca01e08cb4977025b200e639 Mon Sep 17 00:00:00 2001 From: KK Tech Date: Thu, 12 Mar 2026 21:50:33 +0000 Subject: [PATCH 02/10] Revert package.json to upstream version --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 87d27ab8ff..0657e22dd8 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "keywords": [], "author": "Code Your Future", "license": "ISC", - "devDependencies": { - "jest": "^30.2.0" + "dependencies": { + "jest": "^29.7.0" } -} +} \ No newline at end of file From f1de0d9723d8bb9aea3ddc20657ca4ea687c3234 Mon Sep 17 00:00:00 2001 From: KK Tech Date: Thu, 12 Mar 2026 23:33:33 +0000 Subject: [PATCH 03/10] Completed rewrite-tests-with-jest --- .../1-get-angle-type.test.js | 29 +++++++++++++++++-- .../2-is-proper-fraction.test.js | 25 ++++++++++++++-- .../3-get-card-value.test.js | 25 +++++++++++++++- 3 files changed, 74 insertions(+), 5 deletions(-) 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..a0a79c61cb 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 various acute angles, including boundary cases +test("should return 'Acute angle' when (0 < angle < 90)", () => { expect(getAngleType(1)).toEqual("Acute angle"); expect(getAngleType(45)).toEqual("Acute angle"); expect(getAngleType(89)).toEqual("Acute angle"); }); // Case 2: Right angle +test("should return 'Right angle' when angle is 90", () => { + expect(getAngleType(90)).toEqual("Right angle"); +}); + // Case 3: Obtuse angles +test("should return 'Obtuse angle' when (90 < angle < 180)", () => { + expect(getAngleType(91)).toEqual("Obtuse angle"); + expect(getAngleType(135)).toEqual("Obtuse angle"); + expect(getAngleType(179)).toEqual("Obtuse angle"); +}); + // Case 4: Straight angle +test("should return 'Straight angle' when angle is 180", () => { + expect(getAngleType(180)).toEqual("Straight angle"); +}); + // Case 5: Reflex angles +test("should return 'Reflex angle' when (180 < angle < 360)", () => { + expect(getAngleType(181)).toEqual("Reflex angle"); + expect(getAngleType(270)).toEqual("Reflex angle"); + expect(getAngleType(359)).toEqual("Reflex angle"); +}); + // Case 6: Invalid angles +test("should return 'Invalid angle' when angle is invalid", () => { + expect(getAngleType(-1)).toEqual("Invalid angle"); + expect(getAngleType(360)).toEqual("Invalid angle"); + expect(getAngleType(400)).toEqual("Invalid angle"); + expect(getAngleType("invalid")).toEqual("Invalid angle"); +}); \ No newline at end of file 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..156b55b240 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,7 +4,28 @@ 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`, () => { +// Case 1: Proper fractions (numerator < denominator) +test("should return true when numerator is less than denominator", () => { + expect(isProperFraction(1, 2)).toEqual(true); + expect(isProperFraction(3, 4)).toEqual(true); + expect(isProperFraction(0, 5)).toEqual(true); +}); + +// Case 2: Improper fractions (numerator >= denominator) +test("should return false when numerator is greater than or equal to denominator", () => { + expect(isProperFraction(2, 1)).toEqual(false); + expect(isProperFraction(4, 3)).toEqual(false); + expect(isProperFraction(5, 5)).toEqual(false); +}); + +// Case 3: Negative numbers +test("should handle negative numbers", () => { + expect(isProperFraction(-1, 2)).toEqual(true); + expect(isProperFraction(1, -2)).toEqual(true); + expect(isProperFraction(-3, -4)).toEqual(true); +}); + +// Case 4: Denominator is zero +test("should return false when denominator is zero", () => { expect(isProperFraction(1, 0)).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..8d05fabf45 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 @@ -5,10 +5,33 @@ const getCardValue = require("../implement/3-get-card-value"); // TODO: Write tests in Jest syntax to cover all possible outcomes. // Case 1: Ace (A) -test(`Should return 11 when given an ace card`, () => { +test("Should return 11 when given an ace card", () => { expect(getCardValue("A♠")).toEqual(11); }); +// Case 2: Face cards (J, Q, K) +test("Should return 10 when given a face card", () => { + expect(getCardValue("J♠")).toEqual(10); + expect(getCardValue("Q♠")).toEqual(10); + expect(getCardValue("K♠")).toEqual(10); +}); + +// Case 3: Number cards (2-10) +test("Should return the numeric value when given a number card", () => { + expect(getCardValue("2♠")).toEqual(2); + expect(getCardValue("5♠")).toEqual(5); + expect(getCardValue("10♠")).toEqual(10); +}); + +// Case 4: Invalid cards +test("Should throw an error when given an invalid card", () => { + expect(() => getCardValue("1♠")).toThrow("Invalid card"); + expect(() => getCardValue("11♠")).toThrow("Invalid card"); + expect(() => getCardValue("B♠")).toThrow("Invalid card"); + expect(() => getCardValue("A")).toThrow("Invalid card"); + expect(() => getCardValue("")).toThrow("Invalid card"); + expect(() => getCardValue("InvalidCard")).toThrow("Invalid card"); +}); // Suggestion: Group the remaining test data into these categories: // Number Cards (2-10) // Face Cards (J, Q, K) From d52b78fbc0612f8a93c43465bcfeb9c0fa6587b1 Mon Sep 17 00:00:00 2001 From: KK Tech Date: Fri, 13 Mar 2026 13:30:09 +0000 Subject: [PATCH 04/10] fixed task error --- .../implement/3-get-card-value.js | 57 ++++++++----------- 1 file changed, 23 insertions(+), 34 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 f44daea95e..8997b323e4 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,59 +22,48 @@ // execute the code to ensure all tests pass. function getCardValue(card) { - const rank = card.slice(0, -1); - const suit = card.slice(-1); - const validSuits = ["♠", "♥", "♦", "♣"]; - const validRanks = [ - "A", - "2", - "3", - "4", - "5", - "6", - "7", - "8", - "9", - "10", - "J", - "Q", - "K", - ]; - - if (!validSuits.includes(suit) || !validRanks.includes(rank)) { + const validSuits = ["♠", "♣", "♥", "♦"]; + + if (typeof card !== "string" || card.length < 2) { throw new Error("Invalid card"); } + + const suit = card.slice(-1); + const rank = card.slice(0, -1); + + if (!validSuits.includes(suit)) { + throw new Error("invalid card"); + } + if (rank === "A") { return 11; } + if (rank === "J" || rank === "Q" || rank === "K") { return 10; } - return parseInt(rank); + + const numberValue = Number(rank); + + if (!Number.isNaN(numberValue) && numberValue >= 2 && numberValue <= 10) { + return numberValue; + } + + 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; // Helper functions to make our assertions easier to read. -function assertEquals(actualOutput, targetOutput) { - console.assert( - actualOutput === targetOutput, - `Expected ${actualOutput} to equal ${targetOutput}` - ); -} // TODO: Write tests to cover all outcomes, including throwing errors for invalid cards. // Examples: -assertEquals(getCardValue("9♠"), 9); // Handling invalid cards -try { - getCardValue("invalid"); - // This line will not be reached if an error is thrown as expected - console.error("Error was not thrown for invalid card"); -} catch (e) {} +// This line will not be reached if an error is thrown as expected // What other invalid card cases can you think of? From caafa564002981d04d7a4767808511f49ddfb48d Mon Sep 17 00:00:00 2001 From: KK Tech Date: Fri, 13 Mar 2026 14:17:12 +0000 Subject: [PATCH 05/10] re improved the task --- .../implement/3-get-card-value.js | 57 +++++++++++-------- 1 file changed, 34 insertions(+), 23 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 8997b323e4..f44daea95e 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,48 +22,59 @@ // execute the code to ensure all tests pass. function getCardValue(card) { - const validSuits = ["♠", "♣", "♥", "♦"]; - - if (typeof card !== "string" || card.length < 2) { - throw new Error("Invalid card"); - } - - const suit = card.slice(-1); const rank = card.slice(0, -1); - - if (!validSuits.includes(suit)) { - throw new Error("invalid card"); + const suit = card.slice(-1); + const validSuits = ["♠", "♥", "♦", "♣"]; + const validRanks = [ + "A", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "10", + "J", + "Q", + "K", + ]; + + if (!validSuits.includes(suit) || !validRanks.includes(rank)) { + throw new Error("Invalid card"); } - if (rank === "A") { return 11; } - if (rank === "J" || rank === "Q" || rank === "K") { return 10; } - - const numberValue = Number(rank); - - if (!Number.isNaN(numberValue) && numberValue >= 2 && numberValue <= 10) { - return numberValue; - } - - throw new Error("Invalid card"); + return parseInt(rank); } -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; // Helper functions to make our assertions easier to read. +function assertEquals(actualOutput, targetOutput) { + console.assert( + actualOutput === targetOutput, + `Expected ${actualOutput} to equal ${targetOutput}` + ); +} // TODO: Write tests to cover all outcomes, including throwing errors for invalid cards. // Examples: +assertEquals(getCardValue("9♠"), 9); // Handling invalid cards +try { + getCardValue("invalid"); -// This line will not be reached if an error is thrown as expected + // This line will not be reached if an error is thrown as expected + console.error("Error was not thrown for invalid card"); +} catch (e) {} // What other invalid card cases can you think of? From 7e1ce07a1a833949ddb8d55dc3555c68e537b0e1 Mon Sep 17 00:00:00 2001 From: KK Tech Date: Sat, 14 Mar 2026 11:11:16 +0000 Subject: [PATCH 06/10] Improved the Tasks following the feedback instructions --- .../implement/1-get-angle-type.js | 9 +++++++-- .../rewrite-tests-with-jest/1-get-angle-type.test.js | 2 +- .../rewrite-tests-with-jest/2-is-proper-fraction.test.js | 5 ++++- 3 files changed, 12 insertions(+), 4 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 d7074a7f7a..7039638e1c 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 @@ -44,5 +44,10 @@ function assertEquals(actualOutput, targetOutput) { // TODO: Write tests to cover all cases, including boundary and invalid cases. // Example: Identify Right Angles -const right = getAngleType(90); -assertEquals(right, "Right angle"); +assertEquals(getAngleType(45), "Acute angle"); +assertEquals(getAngleType(90), "Right angle"); +assertEquals(getAngleType(120), "Obtuse angle"); +assertEquals(getAngleType(180), "Straight angle"); +assertEquals(getAngleType(270), "Reflex angle"); +assertEquals(getAngleType(-1), "Invalid angle"); +assertEquals(getAngleType(360), "Invalid angle"); 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 a0a79c61cb..6b614906c6 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 @@ -37,7 +37,7 @@ test("should return 'Reflex angle' when (180 < angle < 360)", () => { }); // Case 6: Invalid angles -test("should return 'Invalid angle' when angle is invalid", () => { +test("should return 'Invalid angle' when angle is < 0, >= 360, or not a number", () => { expect(getAngleType(-1)).toEqual("Invalid angle"); expect(getAngleType(360)).toEqual("Invalid angle"); expect(getAngleType(400)).toEqual("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 156b55b240..0dc906a32d 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 @@ -12,10 +12,13 @@ test("should return true when numerator is less than denominator", () => { }); // Case 2: Improper fractions (numerator >= denominator) -test("should return false when numerator is greater than or equal to denominator", () => { +test("should return false when |numerator| >= |denominator|", () => { expect(isProperFraction(2, 1)).toEqual(false); expect(isProperFraction(4, 3)).toEqual(false); expect(isProperFraction(5, 5)).toEqual(false); + expect(isProperFraction(-2, 1)).toEqual(false); + expect(isProperFraction(2, -1)).toEqual(false); + expect(isProperFraction(-5, -5)).toEqual(false); }); // Case 3: Negative numbers From 4eea1fd3eab5622ff032632c35d0f39124a671ac Mon Sep 17 00:00:00 2001 From: KK Tech Date: Sat, 14 Mar 2026 13:26:06 +0000 Subject: [PATCH 07/10] Improved tasks --- .../rewrite-tests-with-jest/1-get-angle-type.test.js | 9 ++++----- .../rewrite-tests-with-jest/2-is-proper-fraction.test.js | 8 ++++---- 2 files changed, 8 insertions(+), 9 deletions(-) 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 6b614906c6..7556c86bde 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,7 +6,7 @@ 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 angle' when angle ∈ ]0, 90[", () => { expect(getAngleType(1)).toEqual("Acute angle"); expect(getAngleType(45)).toEqual("Acute angle"); expect(getAngleType(89)).toEqual("Acute angle"); @@ -18,7 +18,7 @@ test("should return 'Right angle' when angle is 90", () => { }); // Case 3: Obtuse angles -test("should return 'Obtuse angle' when (90 < angle < 180)", () => { +test("should return 'Obtuse angle' when angle ∈ ]90, 180[", () => { expect(getAngleType(91)).toEqual("Obtuse angle"); expect(getAngleType(135)).toEqual("Obtuse angle"); expect(getAngleType(179)).toEqual("Obtuse angle"); @@ -30,16 +30,15 @@ test("should return 'Straight angle' when angle is 180", () => { }); // Case 5: Reflex angles -test("should return 'Reflex angle' when (180 < angle < 360)", () => { +test("should return 'Reflex angle' when angle ∈ ]180, 360[", () => { expect(getAngleType(181)).toEqual("Reflex angle"); expect(getAngleType(270)).toEqual("Reflex angle"); expect(getAngleType(359)).toEqual("Reflex angle"); }); // Case 6: Invalid angles -test("should return 'Invalid angle' when angle is < 0, >= 360, or not a number", () => { +test("should return 'Invalid angle' when angle is < 0 or >= 360", () => { expect(getAngleType(-1)).toEqual("Invalid angle"); expect(getAngleType(360)).toEqual("Invalid angle"); expect(getAngleType(400)).toEqual("Invalid angle"); - expect(getAngleType("invalid")).toEqual("Invalid angle"); }); \ No newline at end of file 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 0dc906a32d..e30562b4ce 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,8 +4,8 @@ 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. -// Case 1: Proper fractions (numerator < denominator) -test("should return true when numerator is less than denominator", () => { +// Case 1: Proper fractions (|numerator| < |denominator|) +test("should return true when |numerator| < |denominator|", () => { expect(isProperFraction(1, 2)).toEqual(true); expect(isProperFraction(3, 4)).toEqual(true); expect(isProperFraction(0, 5)).toEqual(true); @@ -21,8 +21,8 @@ test("should return false when |numerator| >= |denominator|", () => { expect(isProperFraction(-5, -5)).toEqual(false); }); -// Case 3: Negative numbers -test("should handle negative numbers", () => { +// Case 3: Proper fractions with negative values (|numerator| < |denominator|) +test("should return true when |numerator| < |denominator| with negative values", () => { expect(isProperFraction(-1, 2)).toEqual(true); expect(isProperFraction(1, -2)).toEqual(true); expect(isProperFraction(-3, -4)).toEqual(true); From 697147f4aa6a1177f3d8b25e096dd346557c4820 Mon Sep 17 00:00:00 2001 From: KK Tech Date: Sat, 14 Mar 2026 15:13:33 +0000 Subject: [PATCH 08/10] I have uptaded the task by adding 0 in the Acute angle category --- .../implement/1-get-angle-type.js | 2 +- .../rewrite-tests-with-jest/1-get-angle-type.test.js | 3 ++- 2 files changed, 3 insertions(+), 2 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 7039638e1c..61527152ce 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 @@ -15,7 +15,7 @@ // execute the code to ensure all tests pass. function getAngleType(angle) { - if (angle > 0 && angle < 90) { + if (angle >= 0 && angle < 90) { return "Acute angle"; } else if (angle === 90) { return "Right angle"; 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 7556c86bde..b092dc7c74 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,7 +6,8 @@ const getAngleType = require("../implement/1-get-angle-type"); // including boundary and invalid cases. // Case 1: Acute angles -test("should return 'Acute angle' when angle ∈ ]0, 90[", () => { +test("should return 'Acute angle' when angle ∈ [0, 90[", () => { + expect(getAngleType(0)).toEqual("Acute angle"); expect(getAngleType(1)).toEqual("Acute angle"); expect(getAngleType(45)).toEqual("Acute angle"); expect(getAngleType(89)).toEqual("Acute angle"); From 16441f29b4e6fbc838c921dbd7844292c5f53dd0 Mon Sep 17 00:00:00 2001 From: KK Tech Date: Sat, 14 Mar 2026 15:43:55 +0000 Subject: [PATCH 09/10] Update tests and logic so 0 is classified as an invalid angle --- .../implement/1-get-angle-type.js | 3 +-- .../rewrite-tests-with-jest/1-get-angle-type.test.js | 6 +++--- 2 files changed, 4 insertions(+), 5 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 61527152ce..71c618e08e 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 @@ -15,7 +15,7 @@ // execute the code to ensure all tests pass. function getAngleType(angle) { - if (angle >= 0 && angle < 90) { + if (angle > 0 && angle < 90) { return "Acute angle"; } else if (angle === 90) { return "Right angle"; @@ -28,7 +28,6 @@ function getAngleType(angle) { } return "Invalid angle"; } - // The line below allows us to load the getAngleType function into tests in other files. // This will be useful in the "rewrite tests with jest" step. module.exports = getAngleType; 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 b092dc7c74..dfa02677df 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,8 +6,7 @@ const getAngleType = require("../implement/1-get-angle-type"); // including boundary and invalid cases. // Case 1: Acute angles -test("should return 'Acute angle' when angle ∈ [0, 90[", () => { - expect(getAngleType(0)).toEqual("Acute angle"); +test("should return 'Acute angle' when angle ∈ ]0, 90[", () => { expect(getAngleType(1)).toEqual("Acute angle"); expect(getAngleType(45)).toEqual("Acute angle"); expect(getAngleType(89)).toEqual("Acute angle"); @@ -20,7 +19,7 @@ test("should return 'Right angle' when angle is 90", () => { // Case 3: Obtuse angles test("should return 'Obtuse angle' when angle ∈ ]90, 180[", () => { - expect(getAngleType(91)).toEqual("Obtuse angle"); + expect(getAngleType(91)).toEqual("Obtuse angle"); expect(getAngleType(135)).toEqual("Obtuse angle"); expect(getAngleType(179)).toEqual("Obtuse angle"); }); @@ -40,6 +39,7 @@ test("should return 'Reflex angle' when angle ∈ ]180, 360[", () => { // Case 6: Invalid angles test("should return 'Invalid angle' when angle is < 0 or >= 360", () => { expect(getAngleType(-1)).toEqual("Invalid angle"); + expect(getAngleType(0)).toEqual("Invalid angle"); expect(getAngleType(360)).toEqual("Invalid angle"); expect(getAngleType(400)).toEqual("Invalid angle"); }); \ No newline at end of file From 3115102fe930f21a8a7158bc6dd1eeeeb9b761eb Mon Sep 17 00:00:00 2001 From: KK Tech Date: Sat, 14 Mar 2026 15:54:27 +0000 Subject: [PATCH 10/10] uptaded test description --- .../rewrite-tests-with-jest/1-get-angle-type.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 dfa02677df..766ac1398f 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 @@ -19,7 +19,7 @@ test("should return 'Right angle' when angle is 90", () => { // Case 3: Obtuse angles test("should return 'Obtuse angle' when angle ∈ ]90, 180[", () => { - expect(getAngleType(91)).toEqual("Obtuse angle"); + expect(getAngleType(91)).toEqual("Obtuse angle"); expect(getAngleType(135)).toEqual("Obtuse angle"); expect(getAngleType(179)).toEqual("Obtuse angle"); }); @@ -37,7 +37,7 @@ test("should return 'Reflex angle' when angle ∈ ]180, 360[", () => { }); // Case 6: Invalid angles -test("should return 'Invalid angle' when angle is < 0 or >= 360", () => { +test("should return 'Invalid angle' when angle <= 0 or >= 360", () => { expect(getAngleType(-1)).toEqual("Invalid angle"); expect(getAngleType(0)).toEqual("Invalid angle"); expect(getAngleType(360)).toEqual("Invalid angle");