From dc81a0f8d1a467368640cb109945b30a68546ed0 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Sat, 10 Oct 2026 00:54:14 +0100 Subject: [PATCH 01/50] implement a function done --- .../implement/1-get-angle-type.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/implement-and-rewrite-tests/implement/1-get-angle-type.js b/implement-and-rewrite-tests/implement/1-get-angle-type.js index 8a6fba050..4d02ea23f 100644 --- a/implement-and-rewrite-tests/implement/1-get-angle-type.js +++ b/implement-and-rewrite-tests/implement/1-get-angle-type.js @@ -15,7 +15,20 @@ // Acceptance criteria: // After you have implemented the function, write tests to cover all the cases, and // execute the code to ensure all tests pass. - -export function getAngleType(angle) { - // TODO: Implement this function +function getAngleType(angle) { + 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"; } +//export function getAngleType(angle) { +// TODO: Implement this function +//} +console.log(getAngleType(30)); From daed93726879a6da3267ec77db87767c703956da Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Sat, 10 Oct 2026 00:56:45 +0100 Subject: [PATCH 02/50] put back the export line --- implement-and-rewrite-tests/implement/1-get-angle-type.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/implement-and-rewrite-tests/implement/1-get-angle-type.js b/implement-and-rewrite-tests/implement/1-get-angle-type.js index 4d02ea23f..355bb1188 100644 --- a/implement-and-rewrite-tests/implement/1-get-angle-type.js +++ b/implement-and-rewrite-tests/implement/1-get-angle-type.js @@ -28,7 +28,7 @@ function getAngleType(angle) { } return "Invalid angle"; } -//export function getAngleType(angle) { -// TODO: Implement this function -//} -console.log(getAngleType(30)); +export function getAngleType(angle) { + TODO: Implement this function +} + From fc674933facf792ccb68cdc158d6a692075c4c44 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Sat, 10 Oct 2026 00:57:53 +0100 Subject: [PATCH 03/50] wrote the function and body of the function --- .../implement/2-is-proper-fraction.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/implement-and-rewrite-tests/implement/2-is-proper-fraction.js b/implement-and-rewrite-tests/implement/2-is-proper-fraction.js index f983800f0..d484b31f4 100644 --- a/implement-and-rewrite-tests/implement/2-is-proper-fraction.js +++ b/implement-and-rewrite-tests/implement/2-is-proper-fraction.js @@ -12,7 +12,12 @@ // 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 isProperFraction(numerator, denominator) { + if (numerator < denominator) { + return true; + } + return false; +} export function isProperFraction(numerator, denominator) { // TODO: Implement this function } From 7218c4e9934dacc54e7a900cfef565b0cae2bb98 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Mon, 12 Oct 2026 21:43:46 +0100 Subject: [PATCH 04/50] implement a function done --- .../implement/3-get-card-value.js | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/implement-and-rewrite-tests/implement/3-get-card-value.js b/implement-and-rewrite-tests/implement/3-get-card-value.js index 9614ab1ee..abe656e44 100644 --- a/implement-and-rewrite-tests/implement/3-get-card-value.js +++ b/implement-and-rewrite-tests/implement/3-get-card-value.js @@ -24,5 +24,23 @@ // execute the code to ensure all tests pass. export function getCardValue(card) { - // TODO: Implement this function + let suit = card.slice(-1); + let cardInput = card.length; + + if (suit == "♠" || suit == "♥" || suit == "♣" || suit == "♦") { + if (cardInput == 2) { + if (card[0] == "A") { + return 11; + } else if (card[0] == "J" && card[0] == "Q" && card[0] == "K") { + return 10; + } else if (card[0] >= 2 && card[0] < 10) { + return card[0]; + } + } + if (cardInput == 3 && card.slice(0, 2) == "10") { + return 10; + } + return `error`; + // TODO: Implement this function + } } From 764fa711460d0b60cf09ba4b7b2d7ff81cd38748 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Mon, 12 Oct 2026 22:09:36 +0100 Subject: [PATCH 05/50] fixed some errors on the code --- .../implement/1-get-angle-type.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/implement-and-rewrite-tests/implement/1-get-angle-type.js b/implement-and-rewrite-tests/implement/1-get-angle-type.js index 355bb1188..bae58a77e 100644 --- a/implement-and-rewrite-tests/implement/1-get-angle-type.js +++ b/implement-and-rewrite-tests/implement/1-get-angle-type.js @@ -15,20 +15,16 @@ // 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 getAngleType(angle) { - if (angle > 0 && angle < 90) return "acute angle"; +export function getAngleType(angle) { + if (angle > 0 && angle < 90) return "Acute angle"; else if (angle == 90) { - return "right angle"; + return "Right angle"; } else if (angle > 90 && angle < 180) { - return "obtuse angle"; + return "Obtuse angle"; } else if (angle == 180) { - return "straight angle"; + return "Straight angle"; } else if (angle > 180 && angle < 360) { - return "reflex angle"; + return "Reflex angle"; } return "Invalid angle"; } -export function getAngleType(angle) { - TODO: Implement this function -} - From fb8933e0a65725475bbc3cfd2c5eabcdaa09062c Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Mon, 12 Oct 2026 22:11:48 +0100 Subject: [PATCH 06/50] test passe for obtuse --- .../implement-tests-with-node-test/1-get-angle-type.test.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/implement-and-rewrite-tests/implement-tests-with-node-test/1-get-angle-type.test.js b/implement-and-rewrite-tests/implement-tests-with-node-test/1-get-angle-type.test.js index cf50f6cad..8e32f87a7 100644 --- a/implement-and-rewrite-tests/implement-tests-with-node-test/1-get-angle-type.test.js +++ b/implement-and-rewrite-tests/implement-tests-with-node-test/1-get-angle-type.test.js @@ -10,3 +10,7 @@ test("Classifies right angles", () => { const right = getAngleType(90); assert.equal(right, "Right angle"); }); +test("Classifies obtuse angles", () => { + const obtuse = getAngleType(91); + assert.equal(obtuse, "Obtuse angle"); +}); From eee5696e3cde7b325c9872ee0be203a2d698a4f8 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Mon, 12 Oct 2026 22:22:19 +0100 Subject: [PATCH 07/50] test for acute and straight angle passed --- .../1-get-angle-type.test.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/implement-and-rewrite-tests/implement-tests-with-node-test/1-get-angle-type.test.js b/implement-and-rewrite-tests/implement-tests-with-node-test/1-get-angle-type.test.js index 8e32f87a7..b3740e9c4 100644 --- a/implement-and-rewrite-tests/implement-tests-with-node-test/1-get-angle-type.test.js +++ b/implement-and-rewrite-tests/implement-tests-with-node-test/1-get-angle-type.test.js @@ -14,3 +14,11 @@ test("Classifies obtuse angles", () => { const obtuse = getAngleType(91); assert.equal(obtuse, "Obtuse angle"); }); +test("Classifies acute angle", () => { + const acute = getAngleType(75); + assert.equal(acute, "Acute angle"); +}); +test("Classifies straight angle", () => { + const straight = getAngleType(180); + assert.equal(straight, "Straight angle"); +}); From 873bd2a29cd8bcac559a93feb5da68e33cb91105 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Tue, 13 Oct 2026 06:34:34 +0100 Subject: [PATCH 08/50] added test for reflex angle and invalid angles and all test passed --- .../1-get-angle-type.test.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/implement-and-rewrite-tests/implement-tests-with-node-test/1-get-angle-type.test.js b/implement-and-rewrite-tests/implement-tests-with-node-test/1-get-angle-type.test.js index b3740e9c4..324363f37 100644 --- a/implement-and-rewrite-tests/implement-tests-with-node-test/1-get-angle-type.test.js +++ b/implement-and-rewrite-tests/implement-tests-with-node-test/1-get-angle-type.test.js @@ -22,3 +22,19 @@ test("Classifies straight angle", () => { const straight = getAngleType(180); assert.equal(straight, "Straight angle"); }); +test("Classifies reflex angle", () => { + const reflex = getAngleType(270); + assert.equal(reflex, "Reflex angle"); +}); +test("Classifiesreflex angle", () => { + const invalid = getAngleType(0); + assert.equal(invalid, "Invalid angle"); +}); +test("Classifiesreflex angle", () => { + const invalid = getAngleType(-90); + assert.equal(invalid, "Invalid angle"); +}); +test("Classifiesreflex angle", () => { + const invalid = getAngleType(360); + assert.equal(invalid, "Invalid angle"); +}); From 971803f0bd079ffbeb3cbeb3aa163f41eb21f308 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Tue, 13 Oct 2026 06:58:53 +0100 Subject: [PATCH 09/50] wrote a test for proper function --- .../2-is-proper-fraction.test.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js b/implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js index a29084605..cf8cb1d09 100644 --- a/implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js +++ b/implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js @@ -10,3 +10,6 @@ test("Basic proper fraction", () => { // Example: 1/2 is a proper fraction assert.equal(isProperFraction(1, 2), true); }); +test("Basic proper function", () => { + assert.equal(isProperFraction(2, 4), true); +}); From 47a15f8bab7877650ee5c8700c84cf0e97934121 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Tue, 13 Oct 2026 06:59:36 +0100 Subject: [PATCH 10/50] test failed and amend the code --- .../implement/2-is-proper-fraction.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/implement-and-rewrite-tests/implement/2-is-proper-fraction.js b/implement-and-rewrite-tests/implement/2-is-proper-fraction.js index d484b31f4..0e31a3be0 100644 --- a/implement-and-rewrite-tests/implement/2-is-proper-fraction.js +++ b/implement-and-rewrite-tests/implement/2-is-proper-fraction.js @@ -12,12 +12,9 @@ // 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 isProperFraction(numerator, denominator) { +export function isProperFraction(numerator, denominator) { if (numerator < denominator) { return true; } return false; } -export function isProperFraction(numerator, denominator) { - // TODO: Implement this function -} From 8f9469810423dc3b64de3c05852dfe71c7dd73ef Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Tue, 13 Oct 2026 07:22:16 +0100 Subject: [PATCH 11/50] testes passed --- .../2-is-proper-fraction.test.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js b/implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js index cf8cb1d09..dff27ee1f 100644 --- a/implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js +++ b/implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js @@ -13,3 +13,9 @@ test("Basic proper fraction", () => { test("Basic proper function", () => { assert.equal(isProperFraction(2, 4), true); }); +test("Basic proper function", () => { + assert.equal(isProperFraction(4, 1), false); +}); +test("Basic proper function", () => { + assert.equal(isProperFraction(1, 1), false); +}); From dfe51bbd30ddcc2462230fb6a45b82093a32c041 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Tue, 13 Oct 2026 07:23:48 +0100 Subject: [PATCH 12/50] wrote test with a negative input... --- .../2-is-proper-fraction.test.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js b/implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js index dff27ee1f..83f3361cc 100644 --- a/implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js +++ b/implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js @@ -19,3 +19,10 @@ test("Basic proper function", () => { test("Basic proper function", () => { assert.equal(isProperFraction(1, 1), false); }); +test("Basic proper function", () => { + assert.equal(isProperFraction(-1, 2), true); +}); + +test("Basic proper function", () => { + assert.equal(isProperFraction(1, -2), true); +}); From de579323dcecb4cd803a2229f38a78ee4b184134 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Tue, 13 Oct 2026 07:29:59 +0100 Subject: [PATCH 13/50] test failed for negative denominator . Added a Math.abs function so the input can be posetive before they are compared --- implement-and-rewrite-tests/implement/2-is-proper-fraction.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/implement-and-rewrite-tests/implement/2-is-proper-fraction.js b/implement-and-rewrite-tests/implement/2-is-proper-fraction.js index 0e31a3be0..3499e8f4a 100644 --- a/implement-and-rewrite-tests/implement/2-is-proper-fraction.js +++ b/implement-and-rewrite-tests/implement/2-is-proper-fraction.js @@ -13,7 +13,7 @@ // After you have implemented the function, write tests to cover all the cases, and // execute the code to ensure all tests pass. export function isProperFraction(numerator, denominator) { - if (numerator < denominator) { + if (Math.asbs(numerator) < Math.abs(denominator)) { return true; } return false; From 0c400971b5215691c568fa464e39b1ea45212452 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Tue, 13 Oct 2026 07:31:30 +0100 Subject: [PATCH 14/50] test failed and amend the code. --- implement-and-rewrite-tests/implement/2-is-proper-fraction.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/implement-and-rewrite-tests/implement/2-is-proper-fraction.js b/implement-and-rewrite-tests/implement/2-is-proper-fraction.js index 3499e8f4a..ba2d12af1 100644 --- a/implement-and-rewrite-tests/implement/2-is-proper-fraction.js +++ b/implement-and-rewrite-tests/implement/2-is-proper-fraction.js @@ -13,7 +13,7 @@ // After you have implemented the function, write tests to cover all the cases, and // execute the code to ensure all tests pass. export function isProperFraction(numerator, denominator) { - if (Math.asbs(numerator) < Math.abs(denominator)) { + if (Math.abs(numerator) < Math.abs(denominator)) { return true; } return false; From d688c8823123277d7b232d7eec6f5b00eba8a8ac Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Tue, 13 Oct 2026 07:45:39 +0100 Subject: [PATCH 15/50] test added for numertest ator =0, test failed --- .../2-is-proper-fraction.test.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js b/implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js index 83f3361cc..bb9858e67 100644 --- a/implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js +++ b/implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js @@ -26,3 +26,9 @@ test("Basic proper function", () => { test("Basic proper function", () => { assert.equal(isProperFraction(1, -2), true); }); +test("Basic proper function", () => { + assert.equal(isProperFraction(1, 0), false); +}); +test("Basic proper function", () => { + assert.equal(isProperFraction(0, 1), false); +}); From bc3a95cf14659e5a49cf1eaae966dc647e798747 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Tue, 13 Oct 2026 07:50:48 +0100 Subject: [PATCH 16/50] amended the code for tesft fail.now test passed --- implement-and-rewrite-tests/implement/2-is-proper-fraction.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/implement-and-rewrite-tests/implement/2-is-proper-fraction.js b/implement-and-rewrite-tests/implement/2-is-proper-fraction.js index ba2d12af1..570cd9fc4 100644 --- a/implement-and-rewrite-tests/implement/2-is-proper-fraction.js +++ b/implement-and-rewrite-tests/implement/2-is-proper-fraction.js @@ -13,7 +13,7 @@ // After you have implemented the function, write tests to cover all the cases, and // execute the code to ensure all tests pass. export function isProperFraction(numerator, denominator) { - if (Math.abs(numerator) < Math.abs(denominator)) { + if (Math.abs(numerator) < Math.abs(denominator) && numerator !== 0) { return true; } return false; From 20c2bb072061401655f558645437f49e0b078562 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Tue, 13 Oct 2026 07:55:16 +0100 Subject: [PATCH 17/50] added a test of (0,0) test passed --- .../2-is-proper-fraction.test.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js b/implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js index bb9858e67..0f46ef3f1 100644 --- a/implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js +++ b/implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js @@ -13,10 +13,10 @@ test("Basic proper fraction", () => { test("Basic proper function", () => { assert.equal(isProperFraction(2, 4), true); }); -test("Basic proper function", () => { +test("Not prpoer function", () => { assert.equal(isProperFraction(4, 1), false); }); -test("Basic proper function", () => { +test("Not proper function", () => { assert.equal(isProperFraction(1, 1), false); }); test("Basic proper function", () => { @@ -26,9 +26,12 @@ test("Basic proper function", () => { test("Basic proper function", () => { assert.equal(isProperFraction(1, -2), true); }); -test("Basic proper function", () => { +test("Not proper function", () => { assert.equal(isProperFraction(1, 0), false); }); -test("Basic proper function", () => { +test("Not proper function", () => { assert.equal(isProperFraction(0, 1), false); }); +test("Not proper function", () => { + assert.equal(isProperFraction(0, 0), false); +}); From 1e64e02eb1c616de55f18d23dbeb2aa0e37ff711 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Tue, 13 Oct 2026 20:35:54 +0100 Subject: [PATCH 18/50] test passed after modifing the error message --- .../implement-tests-with-node-test/3-get-card-value.test.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js b/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js index f5092d9b1..273197c9d 100644 --- a/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js +++ b/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js @@ -10,7 +10,11 @@ test("Valid single-digit card", () => { }); test("Arbitrary non-card string", () => { - assert.throws(() => getCardValue("invalid"), /Expected a number followed by a suit, but got "invalid"/, "Expected clear error"); + assert.throws( + () => getCardValue("invalid"), + /Expected a number followed by a suit, but got "invalid"/, + "Expected clear error" + ); }); // TODO: What other invalid card cases can you think of? From d645a0c096715b7b8f42ff0d5ae9e091e68b766a Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Tue, 13 Oct 2026 20:36:43 +0100 Subject: [PATCH 19/50] modified the throw new error message and the test passed --- implement-and-rewrite-tests/implement/3-get-card-value.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/implement-and-rewrite-tests/implement/3-get-card-value.js b/implement-and-rewrite-tests/implement/3-get-card-value.js index abe656e44..0afcde709 100644 --- a/implement-and-rewrite-tests/implement/3-get-card-value.js +++ b/implement-and-rewrite-tests/implement/3-get-card-value.js @@ -40,7 +40,7 @@ export function getCardValue(card) { if (cardInput == 3 && card.slice(0, 2) == "10") { return 10; } - return `error`; - // TODO: Implement this function + } else { + throw new Error(`Expected a number followed by a suit, but got "${card}"`); } } From cfb7d08bb9754fd8995750bc0dadfdc7ef9f7f83 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Wed, 14 Oct 2026 18:59:08 +0100 Subject: [PATCH 20/50] did a test and failed . now amended my code --- implement-and-rewrite-tests/implement/3-get-card-value.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/implement-and-rewrite-tests/implement/3-get-card-value.js b/implement-and-rewrite-tests/implement/3-get-card-value.js index 0afcde709..e4f5e98c9 100644 --- a/implement-and-rewrite-tests/implement/3-get-card-value.js +++ b/implement-and-rewrite-tests/implement/3-get-card-value.js @@ -31,13 +31,13 @@ export function getCardValue(card) { if (cardInput == 2) { if (card[0] == "A") { return 11; - } else if (card[0] == "J" && card[0] == "Q" && card[0] == "K") { + } else if (card[0] === "J" || card[0] === "Q" || card[0] === "K") { return 10; } else if (card[0] >= 2 && card[0] < 10) { return card[0]; } } - if (cardInput == 3 && card.slice(0, 2) == "10") { + if (cardInput == 3 && card.slice(0, 2) === "10") { return 10; } } else { From f9c340758cc04f8aa7d6ed94923e5ca7d0f1fde5 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Wed, 14 Oct 2026 21:12:13 +0100 Subject: [PATCH 21/50] edited the code based on the tests failed. --- .../implement/3-get-card-value.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/implement-and-rewrite-tests/implement/3-get-card-value.js b/implement-and-rewrite-tests/implement/3-get-card-value.js index e4f5e98c9..f3b5de133 100644 --- a/implement-and-rewrite-tests/implement/3-get-card-value.js +++ b/implement-and-rewrite-tests/implement/3-get-card-value.js @@ -31,15 +31,20 @@ export function getCardValue(card) { if (cardInput == 2) { if (card[0] == "A") { return 11; - } else if (card[0] === "J" || card[0] === "Q" || card[0] === "K") { + } + if (card[0] == "J" || card[0] == "Q" || card[0] == "K") { return 10; - } else if (card[0] >= 2 && card[0] < 10) { + } + if (card[0] >= 2 && card[0] < 10) { return card[0]; } } if (cardInput == 3 && card.slice(0, 2) === "10") { return 10; } + } + if (card == "invalid") { + throw new Error(`Expected a number followed by a suit, but got "${card}"`); } else { throw new Error(`Expected a number followed by a suit, but got "${card}"`); } From 68f1ecac3775aa1ccbd7012f40cf757041a598d4 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Wed, 14 Oct 2026 21:14:00 +0100 Subject: [PATCH 22/50] added three tests and one of them is throw for invalid rank.still one test failing --- .../3-get-card-value.test.js | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js b/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js index 273197c9d..314050427 100644 --- a/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js +++ b/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js @@ -3,18 +3,30 @@ import test from "node:test"; import { getCardValue } from "../implement/3-get-card-value.js"; -// TODO: Write tests to cover all outcomes, including throwing errors for invalid cards. - test("Valid single-digit card", () => { assert.equal(getCardValue("9♠"), 9); }); +test("returns 11 for ace cards", () => { + assert.equal(getCardValue("A♠"), 11); + assert.equal(getCardValue("A♥"), 11); +}); +test("returns 10 for cards with", () => { + assert.equal(getCardValue("J♠"), 10); + assert.equal(getCardValue("Q♥"), 10); + assert.equal(getCardValue("k♣"), 10); +}); -test("Arbitrary non-card string", () => { +test("throws for invalid rank or suit", () => { assert.throws( () => getCardValue("invalid"), /Expected a number followed by a suit, but got "invalid"/, "Expected clear error" ); }); - -// TODO: What other invalid card cases can you think of? +test("throws for invalid rank", () => { + assert.throws( + () => getCardValue("11♠"), + /Expected a number followed by a suit, but got "11♠"/, + "Expected clear error" + ); +}); From 0cd8cf71800273693b6ec6f9f3f8f27d80ed3ece Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Wed, 14 Oct 2026 22:42:26 +0100 Subject: [PATCH 23/50] declared and initialized validSuit and validRank and edited the code according to the test --- .../implement/3-get-card-value.js | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/implement-and-rewrite-tests/implement/3-get-card-value.js b/implement-and-rewrite-tests/implement/3-get-card-value.js index f3b5de133..6554b9b64 100644 --- a/implement-and-rewrite-tests/implement/3-get-card-value.js +++ b/implement-and-rewrite-tests/implement/3-get-card-value.js @@ -26,6 +26,22 @@ export function getCardValue(card) { let suit = card.slice(-1); let cardInput = card.length; + const validSuit = ["♠", "♥", "♣", "♦"]; + const validRank = [ + "A", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "10", + "J", + "Q", + "K", + ]; if (suit == "♠" || suit == "♥" || suit == "♣" || suit == "♦") { if (cardInput == 2) { @@ -45,7 +61,12 @@ export function getCardValue(card) { } if (card == "invalid") { throw new Error(`Expected a number followed by a suit, but got "${card}"`); - } else { - throw new Error(`Expected a number followed by a suit, but got "${card}"`); + } + + if (!validRank.includes(card[0])) { + throw new Error(`Expected a valid Rank and suit instead got "${card}"`); + } + if (!validSuit.includes(suit)) { + throw new Error(`Expected a valid Rank and suit instead got "${card}"`); } } From a618e0eea4ed9f71660ca993c9891116d7adc85e Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Wed, 14 Oct 2026 22:43:56 +0100 Subject: [PATCH 24/50] now all tests passed except 1 that should return 10 for J,Q,K --- .../3-get-card-value.test.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js b/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js index 314050427..06e8f9aba 100644 --- a/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js +++ b/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js @@ -26,7 +26,21 @@ test("throws for invalid rank or suit", () => { test("throws for invalid rank", () => { assert.throws( () => getCardValue("11♠"), - /Expected a number followed by a suit, but got "11♠"/, + /Expected a valid Rank and suit instead got "11♠"/, + "Expected clear error" + ); +}); +test("throws for invalid suit", () => { + assert.throws( + () => getCardValue("AA"), + /Expected a valid Rank and suit instead got "AA"/, + "Expected clear error" + ); +}); +test("throws for invalid rank", () => { + assert.throws( + () => getCardValue("1♣"), + /Expected a valid Rank and suit instead got "1♣"/, "Expected clear error" ); }); From 5cff5b30171c2b1139c5d096fcb60092b498c328 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Wed, 14 Oct 2026 23:02:10 +0100 Subject: [PATCH 25/50] fixed the test now iall test passed --- .../implement-tests-with-node-test/3-get-card-value.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js b/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js index 06e8f9aba..0cef32952 100644 --- a/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js +++ b/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js @@ -13,7 +13,7 @@ test("returns 11 for ace cards", () => { test("returns 10 for cards with", () => { assert.equal(getCardValue("J♠"), 10); assert.equal(getCardValue("Q♥"), 10); - assert.equal(getCardValue("k♣"), 10); + assert.equal(getCardValue("K♣"), 10); }); test("throws for invalid rank or suit", () => { From 589b0d31d28cd427225b6a7d5d86fb5eef316d7f Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Wed, 14 Oct 2026 23:49:58 +0100 Subject: [PATCH 26/50] added a test on invalid input. test passed --- .../3-get-card-value.test.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js b/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js index 0cef32952..a6a56e163 100644 --- a/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js +++ b/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js @@ -44,3 +44,10 @@ test("throws for invalid rank", () => { "Expected clear error" ); }); +test("throws invalid input", () => { + assert.throws( + () => getCardValue("100"), + /Expected a valid Rank and suit instead got "100"/, + "Expected clear error" + ); +}); From 4784665d84a34b138863263fb503af7bb9824f77 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Wed, 14 Oct 2026 23:52:03 +0100 Subject: [PATCH 27/50] added an if statment for the test writen and test passed --- implement-and-rewrite-tests/implement/3-get-card-value.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/implement-and-rewrite-tests/implement/3-get-card-value.js b/implement-and-rewrite-tests/implement/3-get-card-value.js index 6554b9b64..e03ae44cf 100644 --- a/implement-and-rewrite-tests/implement/3-get-card-value.js +++ b/implement-and-rewrite-tests/implement/3-get-card-value.js @@ -69,4 +69,7 @@ export function getCardValue(card) { if (!validSuit.includes(suit)) { throw new Error(`Expected a valid Rank and suit instead got "${card}"`); } + if (cardInput >= 3 && card[0] !== "10") { + throw new Error(`Expected a valid Rank and suit instead got "${card}"`); + } } From c6355a8824936f0b88be626a9402f1fa65c5baef Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Thu, 15 Oct 2026 01:42:25 +0100 Subject: [PATCH 28/50] wrote the tests and they all passed --- .../1-get-angle-type.test.js | 35 ++++++++++++++++--- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js b/implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js index e0ba786ab..8ffe2a835 100644 --- a/implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js +++ b/implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js @@ -4,13 +4,38 @@ import { getAngleType } from "../implement/1-get-angle-type.js"; // 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 - expect(getAngleType(1)).toEqual("Acute angle"); - expect(getAngleType(45)).toEqual("Acute angle"); - expect(getAngleType(89)).toEqual("Acute angle"); +describe(`valid angles`, () => { + test(`should return "Acute angle" 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"); + }); + test(`should return"Right angle" when (angle = 90)`, () => { + expect(getAngleType(90)).toEqual("Right angle"); + }); + test(`should return "Obtuse angle"when (90 { + expect(getAngleType(91)).toEqual("Obtuse angle"); + expect(getAngleType(135)).toEqual("Obtuse angle"); + expect(getAngleType(179)).toEqual("Obtuse angle"); + }); + test(`should return "Straight angle" when (angle = 180)`, () => { + expect(getAngleType(180)).toEqual("Straight angle"); + }); + 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"); + }); }); +describe(`Invalid angles`, () => { + test(`should return "Invalid angls"when given Invalid angle`, () => { + expect(getAngleType(0)).toEqual("Invalid angle"); + expect(getAngleType(360)).toEqual("Invalid angle"); + expect(getAngleType(-1)).toEqual("Invalid angle"); + }); +}); // Case 2: Right angle // Case 3: Obtuse angles // Case 4: Straight angle From adaacaa9b58fbe4a9b8e28594ca3486e46ab82a2 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Thu, 15 Oct 2026 01:57:44 +0100 Subject: [PATCH 29/50] wrote two test both passed --- .../rewrite-tests-with-jest/2-is-proper-fraction.test.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js b/implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js index 5d49e2d8b..9642f9203 100644 --- a/implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js +++ b/implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js @@ -6,3 +6,9 @@ import { isProperFraction } from "../implement/2-is-proper-fraction.js"; test(`should return false when denominator is zero`, () => { expect(isProperFraction(1, 0)).toEqual(false); }); +test(`should return true when (denominator < numerator)`, () => { + expect(isProperFraction(1, 2)).toEqual(true); +}); +test(`should return false when (denominator> numerator)`, () => { + expect(isProperFraction(4, 2)).toEqual(false); +}); From 6c09cd2753768129e870979a488da3e6e75eb2cc Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Thu, 15 Oct 2026 17:37:40 +0100 Subject: [PATCH 30/50] added some more test all test passed --- .../2-is-proper-fraction.test.js | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js b/implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js index 9642f9203..7419dd849 100644 --- a/implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js +++ b/implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js @@ -6,9 +6,27 @@ import { isProperFraction } from "../implement/2-is-proper-fraction.js"; test(`should return false when denominator is zero`, () => { expect(isProperFraction(1, 0)).toEqual(false); }); -test(`should return true when (denominator < numerator)`, () => { +test(`should return true when (denominator > numerator)`, () => { expect(isProperFraction(1, 2)).toEqual(true); }); -test(`should return false when (denominator> numerator)`, () => { - expect(isProperFraction(4, 2)).toEqual(false); +test(`should return false when (denominator< numerator)`, () => { + expect(isProperFraction(2, 1)).toEqual(false); +}); +test(`should return true when (denominator < numerator)`, () => { + expect(isProperFraction(1, -2)).toEqual(true); +}); +test(`should return false when(numerator = 0)`, () => { + expect(isProperFraction(0, 1)).toEqual(false); +}); +test(`should return false when(numerator = 0 and numerator = 0)`, () => { + expect(isProperFraction(0, 0)).toEqual(false); +}); +test(`should return true when(numerator < denominator)`, () => { + expect(isProperFraction(-1, 2)).toEqual(true); +}); +test(`should return true when numerator > denominator)`, () => { + expect(isProperFraction(-1, -2)).toEqual(true); +}); +test(`should return false when(numerator < denominator)`, () => { + expect(isProperFraction(-2, -1)).toEqual(false); }); From edbd513fbed411485dc6e9f94e270ada4b12f257 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Thu, 15 Oct 2026 17:59:29 +0100 Subject: [PATCH 31/50] added tests for valid input of cards --- .../rewrite-tests-with-jest/3-get-card-value.test.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js b/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js index a6de5a82a..d7d4922a6 100644 --- a/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js +++ b/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js @@ -6,6 +6,16 @@ import { getCardValue } from "../implement/3-get-card-value.js"; test(`Should return 11 when given an ace card`, () => { expect(getCardValue("A♠")).toEqual(11); }); +test(`should retun the numeric value when given numbered cards`, () => { + expect(getCardValue("2♣")).toEqual(2); + expect(getCardValue("6♥")).toEqual(6); + expect(getCardValue("10♦")).toEqual(10); +}); +test(`should retun 10 when given(J,Q,K)cards`, () => { + expect(getCardValue("J♣")).toEqual(10); + expect(getCardValue("Q♥")).toEqual(10); + expect(getCardValue("K♦")).toEqual(10); +}); // Suggestion: Group the remaining test data into these categories: // Number Cards (2-10) @@ -15,4 +25,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 2ea44a4ba914922c720a389f952a6dbae6658ff1 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Thu, 15 Oct 2026 18:40:21 +0100 Subject: [PATCH 32/50] amend code based on the test run and failed.now test passes --- implement-and-rewrite-tests/implement/3-get-card-value.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/implement-and-rewrite-tests/implement/3-get-card-value.js b/implement-and-rewrite-tests/implement/3-get-card-value.js index e03ae44cf..2a74a7216 100644 --- a/implement-and-rewrite-tests/implement/3-get-card-value.js +++ b/implement-and-rewrite-tests/implement/3-get-card-value.js @@ -52,7 +52,7 @@ export function getCardValue(card) { return 10; } if (card[0] >= 2 && card[0] < 10) { - return card[0]; + return Number(card[0]); } } if (cardInput == 3 && card.slice(0, 2) === "10") { From cfd0d489d1d37741770d013078e53d7d82121480 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Thu, 15 Oct 2026 18:43:10 +0100 Subject: [PATCH 33/50] added a test that throws invalid input. test passed --- .../rewrite-tests-with-jest/3-get-card-value.test.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js b/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js index d7d4922a6..aff00fcd1 100644 --- a/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js +++ b/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js @@ -6,7 +6,7 @@ import { getCardValue } from "../implement/3-get-card-value.js"; test(`Should return 11 when given an ace card`, () => { expect(getCardValue("A♠")).toEqual(11); }); -test(`should retun the numeric value when given numbered cards`, () => { +test(`should retun the numeric value when given "numbered" cards`, () => { expect(getCardValue("2♣")).toEqual(2); expect(getCardValue("6♥")).toEqual(6); expect(getCardValue("10♦")).toEqual(10); @@ -14,9 +14,14 @@ test(`should retun the numeric value when given numbered cards`, () => { test(`should retun 10 when given(J,Q,K)cards`, () => { expect(getCardValue("J♣")).toEqual(10); expect(getCardValue("Q♥")).toEqual(10); + expect(getCardValue("K♦")).toEqual(10); }); - +test(`throws for invalid cards`, () => { + expect(() => { + getCardValue("invalid"); + }).toThrow(`Expected a number followed by a suit, but got "invalid"`); +}); // Suggestion: Group the remaining test data into these categories: // Number Cards (2-10) // Face Cards (J, Q, K) From ae41393c322c1376c208f15b04aafe8009db4b43 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Thu, 15 Oct 2026 19:25:48 +0100 Subject: [PATCH 34/50] test throw error is written and test passed --- .../3-get-card-value.test.js | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js b/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js index aff00fcd1..7af782789 100644 --- a/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js +++ b/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js @@ -1,8 +1,5 @@ import { getCardValue } from "../implement/3-get-card-value.js"; -// TODO: Write tests in Jest syntax to cover all possible outcomes. - -// Case 1: Ace (A) test(`Should return 11 when given an ace card`, () => { expect(getCardValue("A♠")).toEqual(11); }); @@ -14,14 +11,35 @@ test(`should retun the numeric value when given "numbered" cards`, () => { test(`should retun 10 when given(J,Q,K)cards`, () => { expect(getCardValue("J♣")).toEqual(10); expect(getCardValue("Q♥")).toEqual(10); - expect(getCardValue("K♦")).toEqual(10); }); + test(`throws for invalid cards`, () => { expect(() => { getCardValue("invalid"); }).toThrow(`Expected a number followed by a suit, but got "invalid"`); }); +test(`throws for invalid rank`, () => { + expect(() => { + getCardValue("1♥"); + }).toThrow(`Expected a valid Rank and suit instead got "1♥"`); +}); +test(`throws for invalid suit`, () => { + expect(() => { + getCardValue("AS"); + }).toThrow(`Expected a valid Rank and suit instead got "AS"`); +}); +test(`throws for invalid input`, () => { + expect(() => { + getCardValue("100"); + }).toThrow(`Expected a valid Rank and suit instead got "100"`); +}); +test(`throws for invalid suit`, () => { + expect(() => { + getCardValue("15♥"); + }).toThrow(`Expected a valid Rank and suit instead got "15♥"`); +}); + // Suggestion: Group the remaining test data into these categories: // Number Cards (2-10) // Face Cards (J, Q, K) From 538f9e4bacd49aa225ec42772a9b408f7bca3249 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Tue, 20 Oct 2026 23:34:50 +0100 Subject: [PATCH 35/50] changed the name of tests and added some more test --- .../2-is-proper-fraction.test.js | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js b/implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js index 0f46ef3f1..cbd09a266 100644 --- a/implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js +++ b/implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js @@ -10,28 +10,33 @@ test("Basic proper fraction", () => { // Example: 1/2 is a proper fraction assert.equal(isProperFraction(1, 2), true); }); -test("Basic proper function", () => { +test("checking when numerator < denominators", () => { assert.equal(isProperFraction(2, 4), true); }); -test("Not prpoer function", () => { +test("checking when Numerator > denominator", () => { assert.equal(isProperFraction(4, 1), false); + assert.equal(isProperFraction(5, 2), false); }); -test("Not proper function", () => { +test("checking when numerator = denominator ", () => { assert.equal(isProperFraction(1, 1), false); + assert.equal(isProperFraction(2, 2), false); }); -test("Basic proper function", () => { +test("Checking when numerator is negative number", () => { assert.equal(isProperFraction(-1, 2), true); + assert.equal(isProperFraction(-4, -6), true); }); - -test("Basic proper function", () => { +test("checking when denominator is negtive number", () => { assert.equal(isProperFraction(1, -2), true); + assert.equal(isProperFraction(2, -8), true); }); -test("Not proper function", () => { +test("checking when denominator = 0", () => { assert.equal(isProperFraction(1, 0), false); + assert.equal(isProperFraction(5, 0), false); }); -test("Not proper function", () => { - assert.equal(isProperFraction(0, 1), false); +test("Checking when numerator = 0", () => { + assert.equal(isProperFraction(0, 1), true); + assert.equal(isProperFraction(0, 5), true); }); -test("Not proper function", () => { +test("checking when numerator= 0 = denominator", () => { assert.equal(isProperFraction(0, 0), false); }); From 8fd5918c5a7edbf28a47ab00cfbdbdb0618ae63d Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Tue, 20 Oct 2026 23:36:06 +0100 Subject: [PATCH 36/50] deleted the numerator value comparing to 0. thinking it can be proper fraction --- implement-and-rewrite-tests/implement/2-is-proper-fraction.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/implement-and-rewrite-tests/implement/2-is-proper-fraction.js b/implement-and-rewrite-tests/implement/2-is-proper-fraction.js index 570cd9fc4..ba2d12af1 100644 --- a/implement-and-rewrite-tests/implement/2-is-proper-fraction.js +++ b/implement-and-rewrite-tests/implement/2-is-proper-fraction.js @@ -13,7 +13,7 @@ // After you have implemented the function, write tests to cover all the cases, and // execute the code to ensure all tests pass. export function isProperFraction(numerator, denominator) { - if (Math.abs(numerator) < Math.abs(denominator) && numerator !== 0) { + if (Math.abs(numerator) < Math.abs(denominator)) { return true; } return false; From 709e8d3d7a9eea7f24bfc6fab6011fc1254fc36d Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Tue, 20 Oct 2026 23:55:24 +0100 Subject: [PATCH 37/50] changed the declaration of valiSuit and valid rank, edited the code. --- .../implement/3-get-card-value.js | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/implement-and-rewrite-tests/implement/3-get-card-value.js b/implement-and-rewrite-tests/implement/3-get-card-value.js index 2a74a7216..6efff8b40 100644 --- a/implement-and-rewrite-tests/implement/3-get-card-value.js +++ b/implement-and-rewrite-tests/implement/3-get-card-value.js @@ -24,8 +24,8 @@ // execute the code to ensure all tests pass. export function getCardValue(card) { - let suit = card.slice(-1); - let cardInput = card.length; + const suit = card.slice(-1); + const cardInput = card.length; const validSuit = ["♠", "♥", "♣", "♦"]; const validRank = [ "A", @@ -42,8 +42,20 @@ export function getCardValue(card) { "Q", "K", ]; + if (card == "invalid") { + throw new Error(`Expected a number followed by a suit, but got "${card}"`); + } - if (suit == "♠" || suit == "♥" || suit == "♣" || suit == "♦") { + if (!validRank.includes(card[0])) { + throw new Error(`Expected a valid Rank and suit instead got "${card}"`); + } + if (!validSuit.includes(suit)) { + throw new Error(`Expected a valid Rank and suit instead got "${card}"`); + } + if (cardInput >= 3 && card[0] !== "10") { + throw new Error(`Expected a valid Rank and suit instead got "${card}"`); + } + if (validSuit) { if (cardInput == 2) { if (card[0] == "A") { return 11; @@ -59,17 +71,4 @@ export function getCardValue(card) { return 10; } } - if (card == "invalid") { - throw new Error(`Expected a number followed by a suit, but got "${card}"`); - } - - if (!validRank.includes(card[0])) { - throw new Error(`Expected a valid Rank and suit instead got "${card}"`); - } - if (!validSuit.includes(suit)) { - throw new Error(`Expected a valid Rank and suit instead got "${card}"`); - } - if (cardInput >= 3 && card[0] !== "10") { - throw new Error(`Expected a valid Rank and suit instead got "${card}"`); - } } From 21f68660ebe2c6bd203dfa697f7bee3551574641 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Wed, 21 Oct 2026 21:42:37 +0100 Subject: [PATCH 38/50] added a test that would return 10. and edited the error message . --- .../3-get-card-value.test.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js b/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js index a6a56e163..05d48af83 100644 --- a/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js +++ b/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js @@ -15,6 +15,9 @@ test("returns 10 for cards with", () => { assert.equal(getCardValue("Q♥"), 10); assert.equal(getCardValue("K♣"), 10); }); +test("returns 10 for cards with", () => { + assert.equal(getCardValue("10♣"), 10); +}); test("throws for invalid rank or suit", () => { assert.throws( @@ -26,28 +29,28 @@ test("throws for invalid rank or suit", () => { test("throws for invalid rank", () => { assert.throws( () => getCardValue("11♠"), - /Expected a valid Rank and suit instead got "11♠"/, + /Expected a valid Rank instead got "11♠"/, "Expected clear error" ); }); test("throws for invalid suit", () => { assert.throws( () => getCardValue("AA"), - /Expected a valid Rank and suit instead got "AA"/, + /Expected a valid Suit instead got "AA"/, "Expected clear error" ); }); test("throws for invalid rank", () => { assert.throws( () => getCardValue("1♣"), - /Expected a valid Rank and suit instead got "1♣"/, + /Expected a valid Rank instead got "1♣"/, "Expected clear error" ); }); test("throws invalid input", () => { assert.throws( () => getCardValue("100"), - /Expected a valid Rank and suit instead got "100"/, + /Expected a valid Suit instead got "100"/, "Expected clear error" ); }); From 88463d88da94e5b4462419c1672faaf1a69acd70 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Wed, 21 Oct 2026 21:44:30 +0100 Subject: [PATCH 39/50] added a test to check on empty space. and eddited the test names and throws --- .../3-get-card-value.test.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js b/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js index 7af782789..7492f99c1 100644 --- a/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js +++ b/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js @@ -13,7 +13,6 @@ test(`should retun 10 when given(J,Q,K)cards`, () => { expect(getCardValue("Q♥")).toEqual(10); expect(getCardValue("K♦")).toEqual(10); }); - test(`throws for invalid cards`, () => { expect(() => { getCardValue("invalid"); @@ -22,22 +21,27 @@ test(`throws for invalid cards`, () => { test(`throws for invalid rank`, () => { expect(() => { getCardValue("1♥"); - }).toThrow(`Expected a valid Rank and suit instead got "1♥"`); + }).toThrow(`Expected a valid Rank instead got "1♥"`); }); test(`throws for invalid suit`, () => { expect(() => { getCardValue("AS"); - }).toThrow(`Expected a valid Rank and suit instead got "AS"`); + }).toThrow(`Expected a valid Suit instead got "AS"`); }); test(`throws for invalid input`, () => { expect(() => { getCardValue("100"); - }).toThrow(`Expected a valid Rank and suit instead got "100"`); + }).toThrow(`Expected a valid Suit instead got "100"`); }); -test(`throws for invalid suit`, () => { +test(`throws for invalid rank`, () => { expect(() => { getCardValue("15♥"); - }).toThrow(`Expected a valid Rank and suit instead got "15♥"`); + }).toThrow(`Expected a valid Rank instead got "15♥"`); +}); +test(`throws for invalid input`, () => { + expect(() => { + getCardValue(" "); + }).toThrow(`Expected a valid Rank and Suit instaed got " "`); }); // Suggestion: Group the remaining test data into these categories: From 9241fc4c448f0b8c64e57098109fa7c9f0f1500b Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Wed, 21 Oct 2026 21:45:36 +0100 Subject: [PATCH 40/50] edited the code based on the tests and to make easy readable --- .../implement/3-get-card-value.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/implement-and-rewrite-tests/implement/3-get-card-value.js b/implement-and-rewrite-tests/implement/3-get-card-value.js index 6efff8b40..d2dfc7490 100644 --- a/implement-and-rewrite-tests/implement/3-get-card-value.js +++ b/implement-and-rewrite-tests/implement/3-get-card-value.js @@ -45,16 +45,16 @@ export function getCardValue(card) { if (card == "invalid") { throw new Error(`Expected a number followed by a suit, but got "${card}"`); } - - if (!validRank.includes(card[0])) { - throw new Error(`Expected a valid Rank and suit instead got "${card}"`); + if (!validRank.includes(card.slice(0, -1)) && !validSuit.includes(suit)) { + throw new Error(`Expected a valid Rank and Suit instaed got "${card}"`); } - if (!validSuit.includes(suit)) { - throw new Error(`Expected a valid Rank and suit instead got "${card}"`); + if (!validRank.includes(card.slice(0, -1))) { + throw new Error(`Expected a valid Rank instead got "${card}"`); } - if (cardInput >= 3 && card[0] !== "10") { - throw new Error(`Expected a valid Rank and suit instead got "${card}"`); + if (!validSuit.includes(suit)) { + throw new Error(`Expected a valid Suit instead got "${card}"`); } + if (validSuit) { if (cardInput == 2) { if (card[0] == "A") { From 7f500658fd7044b3a41ba48a62d5078efb2acfcd Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Wed, 21 Oct 2026 22:05:56 +0100 Subject: [PATCH 41/50] added two test that throws an error when given empty space and empty space before the card --- .../3-get-card-value.test.js | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js b/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js index 05d48af83..154dfa7bf 100644 --- a/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js +++ b/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js @@ -5,6 +5,8 @@ import { getCardValue } from "../implement/3-get-card-value.js"; test("Valid single-digit card", () => { assert.equal(getCardValue("9♠"), 9); + assert.equal(getCardValue("2♥"), 2); + assert.equal(getCardValue("5♣"), 5); }); test("returns 11 for ace cards", () => { assert.equal(getCardValue("A♠"), 11); @@ -33,24 +35,38 @@ test("throws for invalid rank", () => { "Expected clear error" ); }); -test("throws for invalid suit", () => { +test("throws for invalid suit when A is given as suit", () => { assert.throws( () => getCardValue("AA"), /Expected a valid Suit instead got "AA"/, "Expected clear error" ); }); -test("throws for invalid rank", () => { +test("throws for invalid rank when 1 is given as Rank", () => { assert.throws( () => getCardValue("1♣"), /Expected a valid Rank instead got "1♣"/, "Expected clear error" ); }); -test("throws invalid input", () => { +test("throws invalid suit when 0 is given as suit", () => { assert.throws( () => getCardValue("100"), /Expected a valid Suit instead got "100"/, "Expected clear error" ); }); +test("throws invalid input when empty space is given", () => { + assert.throws( + () => getCardValue(" "), + /Expected a valid Rank and Suit instaed got " "/, + "Expected clear error" + ); +}); +test("throws invalid Rank when given empty space before the card", () => { + assert.throws( + () => getCardValue(" 10♠"), + /Expected a valid Rank instead got " 10♠"/, + "Expected clear error" + ); +}); From 227e30386a527ca48f3b76572e9b4d4242d73b1e Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Wed, 21 Oct 2026 22:22:45 +0100 Subject: [PATCH 42/50] added to throw error when input has swapped suit and rank and empty space at the end,test passed --- .../rewrite-tests-with-jest/3-get-card-value.test.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js b/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js index 7492f99c1..4c3b78b90 100644 --- a/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js +++ b/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js @@ -43,6 +43,16 @@ test(`throws for invalid input`, () => { getCardValue(" "); }).toThrow(`Expected a valid Rank and Suit instaed got " "`); }); +test(`throws for invalid input with space ending`, () => { + expect(() => { + getCardValue("4♣ "); + }).toThrow(`Expected a valid Rank and Suit instaed got "4♣ "`); +}); +test(`throws for invalid input`, () => { + expect(() => { + getCardValue("♣4"); + }).toThrow(`Expected a valid Rank and Suit instaed got "♣4"`); +}); // Suggestion: Group the remaining test data into these categories: // Number Cards (2-10) From f0bb649946eb59c80330788b138a8b1ee354ef97 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Wed, 21 Oct 2026 22:29:02 +0100 Subject: [PATCH 43/50] added test for a null input , test passed --- .../3-get-card-value.test.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js b/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js index 154dfa7bf..22ae9d17c 100644 --- a/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js +++ b/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js @@ -70,3 +70,10 @@ test("throws invalid Rank when given empty space before the card", () => { "Expected clear error" ); }); +test("throws invalid input when given null as input", () => { + assert.throws( + () => getCardValue(""), + /Expected a valid Rank and Suit instaed got ""/, + "Expected clear error" + ); +}); From 26a5e791b5d6bac1f04791ee21dabade91f9ba91 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Wed, 21 Oct 2026 22:29:44 +0100 Subject: [PATCH 44/50] addeda test for null input, test passed --- .../rewrite-tests-with-jest/3-get-card-value.test.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js b/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js index 4c3b78b90..80c197df0 100644 --- a/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js +++ b/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js @@ -53,6 +53,11 @@ test(`throws for invalid input`, () => { getCardValue("♣4"); }).toThrow(`Expected a valid Rank and Suit instaed got "♣4"`); }); +test(`throws for invalid input`, () => { + expect(() => { + getCardValue(""); + }).toThrow(`Expected a valid Rank and Suit instaed got ""`); +}); // Suggestion: Group the remaining test data into these categories: // Number Cards (2-10) From c330fd0734e81a2c2473a648da8d83409d58d7ed Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Fri, 23 Oct 2026 19:38:21 +0100 Subject: [PATCH 45/50] amended a code error throw when input is null. --- implement-and-rewrite-tests/implement/3-get-card-value.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/implement-and-rewrite-tests/implement/3-get-card-value.js b/implement-and-rewrite-tests/implement/3-get-card-value.js index d2dfc7490..e8179a374 100644 --- a/implement-and-rewrite-tests/implement/3-get-card-value.js +++ b/implement-and-rewrite-tests/implement/3-get-card-value.js @@ -24,6 +24,9 @@ // execute the code to ensure all tests pass. export function getCardValue(card) { + if (card == null) { + throw new Error(`Expected a valid Rank and Suit instead got null`); + } const suit = card.slice(-1); const cardInput = card.length; const validSuit = ["♠", "♥", "♣", "♦"]; @@ -45,8 +48,9 @@ export function getCardValue(card) { if (card == "invalid") { throw new Error(`Expected a number followed by a suit, but got "${card}"`); } + if (!validRank.includes(card.slice(0, -1)) && !validSuit.includes(suit)) { - throw new Error(`Expected a valid Rank and Suit instaed got "${card}"`); + throw new Error(`Expected a valid Rank and Suit instead got "${card}"`); } if (!validRank.includes(card.slice(0, -1))) { throw new Error(`Expected a valid Rank instead got "${card}"`); From c2a774028c616a88fb92e0e8283caa9ed984b5ff Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Fri, 23 Oct 2026 19:52:28 +0100 Subject: [PATCH 46/50] amended a test , with null input, test pass --- .../implement-tests-with-node-test/3-get-card-value.test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js b/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js index 22ae9d17c..1cec96c2c 100644 --- a/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js +++ b/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js @@ -59,7 +59,7 @@ test("throws invalid suit when 0 is given as suit", () => { test("throws invalid input when empty space is given", () => { assert.throws( () => getCardValue(" "), - /Expected a valid Rank and Suit instaed got " "/, + /Expected a valid Rank and Suit instead got " "/, "Expected clear error" ); }); @@ -72,8 +72,8 @@ test("throws invalid Rank when given empty space before the card", () => { }); test("throws invalid input when given null as input", () => { assert.throws( - () => getCardValue(""), - /Expected a valid Rank and Suit instaed got ""/, + () => getCardValue(null), + /Expected a valid Rank and Suit instead got null/, "Expected clear error" ); }); From 9da1f9cb0394b9add187c7bf210fa5946561df76 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Fri, 23 Oct 2026 19:53:09 +0100 Subject: [PATCH 47/50] amended a test when input is null, test passed --- .../rewrite-tests-with-jest/3-get-card-value.test.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js b/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js index 80c197df0..101f6e2cf 100644 --- a/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js +++ b/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js @@ -41,22 +41,22 @@ test(`throws for invalid rank`, () => { test(`throws for invalid input`, () => { expect(() => { getCardValue(" "); - }).toThrow(`Expected a valid Rank and Suit instaed got " "`); + }).toThrow(`Expected a valid Rank and Suit instead got " "`); }); test(`throws for invalid input with space ending`, () => { expect(() => { getCardValue("4♣ "); - }).toThrow(`Expected a valid Rank and Suit instaed got "4♣ "`); + }).toThrow(`Expected a valid Rank and Suit instead got "4♣ "`); }); test(`throws for invalid input`, () => { expect(() => { getCardValue("♣4"); - }).toThrow(`Expected a valid Rank and Suit instaed got "♣4"`); + }).toThrow(`Expected a valid Rank and Suit instead got "♣4"`); }); test(`throws for invalid input`, () => { expect(() => { - getCardValue(""); - }).toThrow(`Expected a valid Rank and Suit instaed got ""`); + getCardValue(null); + }).toThrow(`Expected a valid Rank and Suit instead got null`); }); // Suggestion: Group the remaining test data into these categories: From 2923430cc9a038b9ee6e931b4692665d157c3367 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Fri, 23 Oct 2026 22:12:21 +0100 Subject: [PATCH 48/50] amended a code when numerator =0 --- implement-and-rewrite-tests/implement/2-is-proper-fraction.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/implement-and-rewrite-tests/implement/2-is-proper-fraction.js b/implement-and-rewrite-tests/implement/2-is-proper-fraction.js index ba2d12af1..0db98379d 100644 --- a/implement-and-rewrite-tests/implement/2-is-proper-fraction.js +++ b/implement-and-rewrite-tests/implement/2-is-proper-fraction.js @@ -13,6 +13,10 @@ // After you have implemented the function, write tests to cover all the cases, and // execute the code to ensure all tests pass. export function isProperFraction(numerator, denominator) { + if (numerator == 0) { + // 0 is not a proper fraction it is a whole number + return false; + } if (Math.abs(numerator) < Math.abs(denominator)) { return true; } From 79e3535fdcd049bbdbffa9728204b993141471aa Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Fri, 23 Oct 2026 22:13:58 +0100 Subject: [PATCH 49/50] amended the test whe numerator =0 --- .../2-is-proper-fraction.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js b/implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js index cbd09a266..f6de23512 100644 --- a/implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js +++ b/implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js @@ -34,8 +34,8 @@ test("checking when denominator = 0", () => { assert.equal(isProperFraction(5, 0), false); }); test("Checking when numerator = 0", () => { - assert.equal(isProperFraction(0, 1), true); - assert.equal(isProperFraction(0, 5), true); + assert.equal(isProperFraction(0, 1), false); + assert.equal(isProperFraction(0, 5), false); }); test("checking when numerator= 0 = denominator", () => { assert.equal(isProperFraction(0, 0), false); From a2f7fb060b0b40448ca4820d1af4815f39569f0f Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Fri, 23 Oct 2026 22:16:59 +0100 Subject: [PATCH 50/50] amended a test when numerator =0,test pass --- .../rewrite-tests-with-jest/2-is-proper-fraction.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js b/implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js index 7419dd849..26cfdb56c 100644 --- a/implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js +++ b/implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js @@ -24,9 +24,9 @@ test(`should return false when(numerator = 0 and numerator = 0)`, () => { test(`should return true when(numerator < denominator)`, () => { expect(isProperFraction(-1, 2)).toEqual(true); }); -test(`should return true when numerator > denominator)`, () => { +test(`should return true when the input is -ve |numerator|<|denominator|`, () => { expect(isProperFraction(-1, -2)).toEqual(true); }); -test(`should return false when(numerator < denominator)`, () => { +test(`should return false when the input is -ve |numerator|>|denominator|`, () => { expect(isProperFraction(-2, -1)).toEqual(false); });