From 3441cd5817c6dafaa8558d24d74de94267352f05 Mon Sep 17 00:00:00 2001 From: pathywang Date: Sun, 15 Feb 2026 08:36:02 +0000 Subject: [PATCH 01/11] complete code --- .../implement/3-get-card-value.js | 58 ++++++++++++++++--- 1 file changed, 51 insertions(+), 7 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 c7559e787e..3c6323ed90 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,8 +22,23 @@ // execute the code to ensure all tests pass. function getCardValue(card) { - // TODO: Implement this function -} + const validSuits = ["♠", "♥", "♦", "♣"]; + const validRanks = ["A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"]; + + const suit = card.slice(-1); + const rank = card.slice(0, -1); + + + if (!validSuits.includes(suit) || !validRanks.includes(rank)) { + throw new Error("Invalid card"); + } + + if (rank === "A") return 11; + if (["J", "Q", "K"].includes(rank)) return 10; + + return Number(rank); +} + // 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. @@ -38,15 +53,44 @@ function assertEquals(actualOutput, targetOutput) { } // TODO: Write tests to cover all outcomes, including throwing errors for invalid cards. -// Examples: +// Examples 1 numbers: +// Examples 1 numbers: assertEquals(getCardValue("9♠"), 9); +assertEquals(getCardValue("5♣"), 5); + +//Examples A: +assertEquals(getCardValue("A♦"), 11) -// Handling invalid cards -try { - getCardValue("invalid"); +//Examples J Q K:, +assertEquals(getCardValue("Q♥"), 10) +assertEquals(getCardValue("K♥"), 10) + +//Examples invalid numbers: +assertThrow(()=>getCardValue("1♥")) +assertThrow(()=>getCardValue("11♥")) + +//Examples invalid suit: +assertThrow(()=>getCardValue("A*")) + +//Examples missing rank or suit: +assertThrow(()=>getCardValue("♥")) +assertThrow(()=>getCardValue("5")) + +//Example extra suit: +assertThrow(()=>getCardValue("Q♠♠")) + + +function assertThrow(fn){ +try { (fn) + // we try to run this function, if it throws, stop running this bit and run the catch below // This line will not be reached if an error is thrown as expected console.error("Error was not thrown for invalid card"); -} catch (e) {} +} catch (error) { + // if the above code throws, we catch the error here, that stops the whole program crashing + console.log('there was an error getting card value!',error) +}} + +console.log(' we finished running getcardvalue') // What other invalid card cases can you think of? From 9fd74bc52e6f80c1da754f5e9673a69a42a9c523 Mon Sep 17 00:00:00 2001 From: pathywang Date: Sun, 15 Feb 2026 08:43:28 +0000 Subject: [PATCH 02/11] commit wrong branch --- .../implement/3-get-card-value.js | 40 +------------------ 1 file changed, 1 insertion(+), 39 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 3c6323ed90..84310f9279 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,21 +22,7 @@ // execute the code to ensure all tests pass. function getCardValue(card) { - const validSuits = ["♠", "♥", "♦", "♣"]; - const validRanks = ["A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"]; - - const suit = card.slice(-1); - const rank = card.slice(0, -1); - - if (!validSuits.includes(suit) || !validRanks.includes(rank)) { - throw new Error("Invalid card"); - } - - if (rank === "A") return 11; - if (["J", "Q", "K"].includes(rank)) return 10; - - return Number(rank); } @@ -56,28 +42,6 @@ function assertEquals(actualOutput, targetOutput) { // Examples 1 numbers: // Examples 1 numbers: assertEquals(getCardValue("9♠"), 9); -assertEquals(getCardValue("5♣"), 5); - -//Examples A: -assertEquals(getCardValue("A♦"), 11) - -//Examples J Q K:, -assertEquals(getCardValue("Q♥"), 10) -assertEquals(getCardValue("K♥"), 10) - -//Examples invalid numbers: -assertThrow(()=>getCardValue("1♥")) -assertThrow(()=>getCardValue("11♥")) - -//Examples invalid suit: -assertThrow(()=>getCardValue("A*")) - -//Examples missing rank or suit: -assertThrow(()=>getCardValue("♥")) -assertThrow(()=>getCardValue("5")) - -//Example extra suit: -assertThrow(()=>getCardValue("Q♠♠")) function assertThrow(fn){ @@ -88,9 +52,7 @@ try { (fn) console.error("Error was not thrown for invalid card"); } catch (error) { // if the above code throws, we catch the error here, that stops the whole program crashing - console.log('there was an error getting card value!',error) -}} + -console.log(' we finished running getcardvalue') // What other invalid card cases can you think of? From 2940579a5f0976fc3115d7c689289b9a0e0da253 Mon Sep 17 00:00:00 2001 From: pathywang Date: Mon, 23 Feb 2026 22:40:48 +0000 Subject: [PATCH 03/11] commit again --- .../implement/1-get-angle-type.js | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) 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..ec6627390f 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,12 @@ // execute the code to ensure all tests pass. function getAngleType(angle) { - // TODO: Implement this function + if (angle === 90) return "Right angle"; + if (angle < 90) return "Acute angle"; + if (90 Date: Mon, 23 Feb 2026 22:42:28 +0000 Subject: [PATCH 04/11] commit --- .../implement/2-is-proper-fraction.js | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) 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..a5b53ca0c7 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,7 +11,7 @@ // execute the code to ensure all tests pass. function isProperFraction(numerator, denominator) { - // TODO: Implement this function + return Math.abs(numerator) < Math.abs(denominator) } // The line below allows us to load the isProperFraction function into tests in other files. @@ -31,3 +31,27 @@ function assertEquals(actualOutput, targetOutput) { // Example: 1/2 is a proper fraction assertEquals(isProperFraction(1, 2), true); + +//Case 2: 5/5 is not a proper fraction +assertEquals(isProperFraction(5,5), false); + +//Case 3: (-3)/(-5) is a proper fraction +assertEquals(isFinite(-3,-5), true); + +//Case 4: (-4)/6 is a proper fraction +assertEquals(isProperFraction(-4,6),true); + +//case 5: 5/(-8) is a proper fraction +assertEquals(isProperFraction(5,-8), true); + +//case 6: 9/7 is not a proper fraction +assertEquals(isProperFraction(9,7), false); + +//case 7: 7/0 is not a proper fraction +assertEquals(isProperFraction(7,0), false); + +//case 8: 0/6 is a proper fraction +assertEquals(isProperFraction(0,6), true); + +//case 9: 0/-8 is a proper fraction +assertEquals(isProperFraction(0,-8), true); \ No newline at end of file From c43a3214b6bf41eef13120f62bee330bc61abb22 Mon Sep 17 00:00:00 2001 From: pathywang Date: Mon, 23 Feb 2026 22:44:01 +0000 Subject: [PATCH 05/11] commit again --- .../implement/3-get-card-value.js | 42 ++++++++++++++++++- 1 file changed, 40 insertions(+), 2 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 84310f9279..2e36221621 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,21 @@ // execute the code to ensure all tests pass. function getCardValue(card) { + const validSuits = ["♠", "♥", "♦", "♣"]; + const validRanks = ["A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"]; + + const suit = card.slice(-1); + const rank = card.slice(0, -1); + + if (!validSuits.includes(suit) || !validRanks.includes(rank)) { + throw new Error("Invalid card"); + } + + if (rank === "A") return 11; + if (["J", "Q", "K"].includes(rank)) return 10; + + return Number(rank); } @@ -42,17 +56,41 @@ function assertEquals(actualOutput, targetOutput) { // Examples 1 numbers: // Examples 1 numbers: assertEquals(getCardValue("9♠"), 9); +assertEquals(getCardValue("5♣"), 5); + +//Examples A: +assertEquals(getCardValue("A♦"), 11) + +//Examples J Q K:, +assertEquals(getCardValue("Q♥"), 10) +assertEquals(getCardValue("K♥"), 10) + +//Examples invalid numbers: +assertThrow(()=>getCardValue("1♥")) +assertThrow(()=>getCardValue("11♥")) + +//Examples invalid suit: +assertThrow(()=>getCardValue("A*")) + +//Examples missing rank or suit: +assertThrow(()=>getCardValue("♥")) +assertThrow(()=>getCardValue("5")) + +//Example extra suit: +assertThrow(()=>getCardValue("Q♠♠")) function assertThrow(fn){ -try { (fn) +try { fn() // we try to run this function, if it throws, stop running this bit and run the catch below // This line will not be reached if an error is thrown as expected console.error("Error was not thrown for invalid card"); } catch (error) { // if the above code throws, we catch the error here, that stops the whole program crashing - + console.log('there was an error getting card value!',error) +}} +console.log(' we finished running getCardValue') // What other invalid card cases can you think of? From 43a9f321b52a267f96302c217e5421343201db96 Mon Sep 17 00:00:00 2001 From: pathywang Date: Mon, 23 Feb 2026 22:45:21 +0000 Subject: [PATCH 06/11] commit --- .../1-get-angle-type.test.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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..ffbec8e2e4 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 @@ -14,7 +14,24 @@ test(`should return "Acute angle" when (0 < angle < 90)`, () => { }); // Case 2: Right angle +test ('should return "Right angle" when angle ===90',() => { + expect(getAngleType(90)).toEqual("Right angle"); +}) // Case 3: Obtuse angles +test ('should return "Obtuse angle" when (90 { + expect(getAngleType(135)).toEqual("Obtuse angle"); +}) // Case 4: Straight angle +test ('should return "Straight angle" when angle ===180',() => { + expect(getAngleType(180)).toEqual("Straight angle"); +}) + // Case 5: Reflex angles +test ('should return "Obtuse angle" when (180 { + expect(getAngleType(275)).toEqual("Reflex angle"); +}) + // Case 6: Invalid angles +test('should return "Invalid angle"when (angle>=360)', ()=> { + expect(getAngleType(360)).toEqual("Invalid angle"); +}) From 630ae85f5aaa74bb0b88703dc4e38817fb5a1416 Mon Sep 17 00:00:00 2001 From: pathywang Date: Mon, 23 Feb 2026 22:46:38 +0000 Subject: [PATCH 07/11] commit --- .../2-is-proper-fraction.test.js | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) 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..be27ca54b1 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,31 @@ 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 +/// Special case: denominator is zero test(`should return false when denominator is zero`, () => { expect(isProperFraction(1, 0)).toEqual(false); }); + +//case:absolute numerator is bigger than absolute denominator +test ('should return false when numerator absolute is bigger than denominator absolute',() => { + expect(isProperFraction(5, -4)).toEqual(false); +}) + +//case:numerator is the same as denominator +test('should return false if numerator is the same as denominator', () =>{ + expect(isProperFraction(-9,-9)).toEqual(false) +}) + +//case: absolute numerator is less than absolute denominator +test ('should return true when numerator absolute is less than denominator absolute',() => { + expect(isProperFraction(3,-8)).toEqual(true); +}) + +//case: numerator is zero +test(`should return true when nominator is zero`, () => { + expect(isProperFraction(0,-3)).toEqual(true); +}); + + + + From 8850c1c31c2af415e7a24e9d32a95124e9911d8e Mon Sep 17 00:00:00 2001 From: pathywang Date: Mon, 23 Feb 2026 22:47:50 +0000 Subject: [PATCH 08/11] commit --- .../3-get-card-value.test.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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..52739de9ee 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 @@ -14,7 +14,23 @@ test(`Should return 11 when given an ace card`, () => { // Face Cards (J, Q, K) // Invalid Cards +// Case 2 : Number(2-10) +test('should return the exact number when given an number card', () =>{ + expect(getCardValue("5♠")).toEqual(5); +}) + +//case 3 : face card(J,Q,K) +test('should return number when given face card', () =>{ + expect(getCardValue("K♠")).toEqual(10); +}) + +// case 4: Invalid cards +test('throws new Error', () => { + expect(() => getCardValue("9**")).toThrow("Invalid 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 2f4e88272ba0c3413b3acf1af336bef1991fa276 Mon Sep 17 00:00:00 2001 From: pathywang Date: Sun, 1 Mar 2026 20:24:15 +0000 Subject: [PATCH 09/11] commit --- .../rewrite-tests-with-jest/3-get-card-value.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 52739de9ee..a9415b53c0 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 @@ -4,7 +4,7 @@ const getCardValue = require("../implement/3-get-card-value"); // TODO: Write tests in Jest syntax to cover all possible outcomes. -// Case 1: Ace (A) +// Case 1: Ace (A)1 test(`Should return 11 when given an ace card`, () => { expect(getCardValue("A♠")).toEqual(11); }); From eac9e9ab50a584b1c06b391731e1f2e0a20d0cba Mon Sep 17 00:00:00 2001 From: pathywang Date: Sat, 7 Mar 2026 15:44:36 +0000 Subject: [PATCH 10/11] correction --- .../implement/1-get-angle-type.js | 24 +++++++++++++------ .../implement/2-is-proper-fraction.js | 2 +- .../implement/3-get-card-value.js | 5 ++-- .../1-get-angle-type.test.js | 16 +++++++++++-- .../2-is-proper-fraction.test.js | 14 ++++++++--- 5 files changed, 46 insertions(+), 15 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 ec6627390f..417ad70afe 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,12 +15,14 @@ // execute the code to ensure all tests pass. function getAngleType(angle) { - if (angle === 90) return "Right angle"; - if (angle < 90) return "Acute angle"; - if (90 360) return "Invalid angle"; + + if (angle < 90) return "Acute angle"; + if (angle === 90) return "Right angle"; + if (angle < 180) return "Obtuse angle"; + if (angle === 180) return "Straight angle"; + if (angle < 360) return "Reflex angle"; + if (angle === 360) return "Full rotation angle"; } // The line below allows us to load the getAngleType function into tests in other files. @@ -45,6 +47,12 @@ assertEquals(right, "Right angle"); const acute = getAngleType(45); assertEquals(acute, "Acute angle"); +const angle1=getAngleType(89) +assertEquals(angle1, "Acute angle"); + +const angle2=getAngleType(-45) +assertEquals(angle2, "Invalid angle"); + // Case 3: Identify Obtuse Angles: const obtuse = getAngleType(120); assertEquals(obtuse, "Obtuse angle"); @@ -61,4 +69,6 @@ assertEquals(reflex, "Reflex angle"); assertEquals(getAngleType(367),"Invalid angle"); //case 7: Identify boundary angle: -assertEquals(getAngleType(1), "Acute angle"); \ No newline at end of file +assertEquals(getAngleType(1), "Acute angle"); + +assertEquals(getAngleType(0), "Invalid angle"); \ No newline at end of file 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 a5b53ca0c7..ca28df1117 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 @@ -36,7 +36,7 @@ assertEquals(isProperFraction(1, 2), true); assertEquals(isProperFraction(5,5), false); //Case 3: (-3)/(-5) is a proper fraction -assertEquals(isFinite(-3,-5), true); +assertEquals(isProperFraction(-3,-5), true); //Case 4: (-4)/6 is a proper fraction assertEquals(isProperFraction(-4,6),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 2e36221621..0bf4daff44 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 @@ -62,8 +62,9 @@ assertEquals(getCardValue("5♣"), 5); assertEquals(getCardValue("A♦"), 11) //Examples J Q K:, -assertEquals(getCardValue("Q♥"), 10) -assertEquals(getCardValue("K♥"), 10) +assertEquals(getCardValue("Q♣"), 10) +assertEquals(getCardValue("K♠"), 10) +assertEquals(getCardValue("J♣"), 10) //Examples invalid numbers: assertThrow(()=>getCardValue("1♥")) 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 ffbec8e2e4..b3ef990ad1 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 @@ -12,7 +12,7 @@ test(`should return "Acute angle" when (0 < angle < 90)`, () => { expect(getAngleType(45)).toEqual("Acute angle"); expect(getAngleType(89)).toEqual("Acute angle"); }); - + // Case 2: Right angle test ('should return "Right angle" when angle ===90',() => { expect(getAngleType(90)).toEqual("Right angle"); @@ -21,6 +21,7 @@ test ('should return "Right angle" when angle ===90',() => { test ('should return "Obtuse angle" when (90 { expect(getAngleType(135)).toEqual("Obtuse angle"); }) + // Case 4: Straight angle test ('should return "Straight angle" when angle ===180',() => { expect(getAngleType(180)).toEqual("Straight angle"); @@ -32,6 +33,17 @@ test ('should return "Obtuse angle" when (180 { }) // Case 6: Invalid angles + +test('should return "Full rotation angle" when (angle=360)', ()=> { + expect(getAngleType(360)).toEqual("Full rotation angle"); +}) + test('should return "Invalid angle"when (angle>=360)', ()=> { - expect(getAngleType(360)).toEqual("Invalid angle"); + expect(getAngleType(1012)).toEqual("Invalid angle"); }) + + +test('should return "Invalid angle" when angle <= 0', () => { + expect(getAngleType(-5)).toEqual("Invalid angle"); + expect(getAngleType(-10)).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 be27ca54b1..f7ea08f8d6 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,17 +12,25 @@ test(`should return false when denominator is zero`, () => { //case:absolute numerator is bigger than absolute denominator test ('should return false when numerator absolute is bigger than denominator absolute',() => { expect(isProperFraction(5, -4)).toEqual(false); -}) + expect(isProperFraction(-5, 4)).toEqual(false); + expect(isProperFraction(-5, -4)).toEqual(false); + expect(isProperFraction(5, 4)).toEqual(false); + }); //case:numerator is the same as denominator test('should return false if numerator is the same as denominator', () =>{ expect(isProperFraction(-9,-9)).toEqual(false) + expect(isProperFraction(4,4)).toEqual(false) }) //case: absolute numerator is less than absolute denominator test ('should return true when numerator absolute is less than denominator absolute',() => { - expect(isProperFraction(3,-8)).toEqual(true); -}) + expect(isProperFraction(3, 8)).toEqual(true); + expect(isProperFraction(-3, 8)).toEqual(true); + expect(isProperFraction(3, -8)).toEqual(true); + expect(isProperFraction(-3, -8)).toEqual(true); + }); + //case: numerator is zero test(`should return true when nominator is zero`, () => { From e6ce67c1985f331a0d55d095a23d12bfb334c2a5 Mon Sep 17 00:00:00 2001 From: pathywang Date: Mon, 9 Mar 2026 14:01:02 +0000 Subject: [PATCH 11/11] correction --- .../rewrite-tests-with-jest/1-get-angle-type.test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 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 b3ef990ad1..0abe685612 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 @@ -18,7 +18,7 @@ test ('should return "Right angle" when angle ===90',() => { expect(getAngleType(90)).toEqual("Right angle"); }) // Case 3: Obtuse angles -test ('should return "Obtuse angle" when (90 { +test ('should return "Obtuse angle" when (90 { expect(getAngleType(135)).toEqual("Obtuse angle"); }) @@ -28,7 +28,7 @@ test ('should return "Straight angle" when angle ===180',() => { }) // Case 5: Reflex angles -test ('should return "Obtuse angle" when (180 { +test ('should return "Reflex angle" when (180 { expect(getAngleType(275)).toEqual("Reflex angle"); }) @@ -38,7 +38,7 @@ test('should return "Full rotation angle" when (angle=360)', ()=> { expect(getAngleType(360)).toEqual("Full rotation angle"); }) -test('should return "Invalid angle"when (angle>=360)', ()=> { +test('should return "Invalid angle"when (angle>360)', ()=> { expect(getAngleType(1012)).toEqual("Invalid angle"); })