From 91eca89cb7028c2606d833852c48875767ae71a6 Mon Sep 17 00:00:00 2001 From: Alrzini2025 Date: Sat, 28 Feb 2026 14:55:53 +0000 Subject: [PATCH 1/6] This is first part for Sprint-3 --- Sprint-3/2-practice-tdd/count.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-3/2-practice-tdd/count.test.js b/Sprint-3/2-practice-tdd/count.test.js index 179ea0ddf7..7cc29e6521 100644 --- a/Sprint-3/2-practice-tdd/count.test.js +++ b/Sprint-3/2-practice-tdd/count.test.js @@ -17,7 +17,7 @@ test("should count multiple occurrences of a character", () => { expect(count).toEqual(5); }); -// Scenario: No Occurrences +// Scenario: No Occurrences in file // Given the input string `str`, // And a character `char` that does not exist within `str`. // When the function is called with these inputs, From 5802c53a61e4ebed72509d9b33db93f86ca72ecb Mon Sep 17 00:00:00 2001 From: Alrzini2025 Date: Sat, 28 Feb 2026 15:08:25 +0000 Subject: [PATCH 2/6] solution for spring 3.1 --- .../1-implement-and-rewrite-tests/implement/1-get-angle-type.js | 2 +- .../implement/2-is-proper-fraction.js | 2 +- .../1-implement-and-rewrite-tests/implement/3-get-card-value.js | 2 +- 3 files changed, 3 insertions(+), 3 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..bfc7ee13ae 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 @@ -32,6 +32,6 @@ function assertEquals(actualOutput, targetOutput) { } // TODO: Write tests to cover all cases, including boundary and invalid cases. -// Example: Identify Right Angles +// Example: Identify Right Angles. const right = getAngleType(90); assertEquals(right, "Right angle"); diff --git a/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js b/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js index 970cb9b641..1bcd842041 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 @@ -29,5 +29,5 @@ function assertEquals(actualOutput, targetOutput) { // TODO: Write tests to cover all cases. // What combinations of numerators and denominators should you test? -// Example: 1/2 is a proper fraction +// Example: 1/2 is a proper fraction. assertEquals(isProperFraction(1, 2), true); diff --git a/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js b/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js index c7559e787e..3d897461e6 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 @@ -45,7 +45,7 @@ assertEquals(getCardValue("9♠"), 9); 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) {} From 406890d68c902d5a22c21cedacaee532338fc624 Mon Sep 17 00:00:00 2001 From: Alrzini2025 Date: Sat, 28 Feb 2026 15:11:11 +0000 Subject: [PATCH 3/6] removing wrong file --- Sprint-3/2-practice-tdd/count.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-3/2-practice-tdd/count.test.js b/Sprint-3/2-practice-tdd/count.test.js index 7cc29e6521..179ea0ddf7 100644 --- a/Sprint-3/2-practice-tdd/count.test.js +++ b/Sprint-3/2-practice-tdd/count.test.js @@ -17,7 +17,7 @@ test("should count multiple occurrences of a character", () => { expect(count).toEqual(5); }); -// Scenario: No Occurrences in file +// Scenario: No Occurrences // Given the input string `str`, // And a character `char` that does not exist within `str`. // When the function is called with these inputs, From 21283510fdf7086344f682e29f341749c4102c8c Mon Sep 17 00:00:00 2001 From: Alrzini2025 Date: Sat, 28 Feb 2026 15:24:12 +0000 Subject: [PATCH 4/6] sprint 3.2 solution --- Sprint-3/2-practice-tdd/count.test.js | 2 +- Sprint-3/2-practice-tdd/get-ordinal-number.test.js | 2 +- Sprint-3/2-practice-tdd/repeat-str.test.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Sprint-3/2-practice-tdd/count.test.js b/Sprint-3/2-practice-tdd/count.test.js index 179ea0ddf7..8bf8f7d664 100644 --- a/Sprint-3/2-practice-tdd/count.test.js +++ b/Sprint-3/2-practice-tdd/count.test.js @@ -17,7 +17,7 @@ test("should count multiple occurrences of a character", () => { expect(count).toEqual(5); }); -// Scenario: No Occurrences +// Scenario: No Occurrences. // Given the input string `str`, // And a character `char` that does not exist within `str`. // When the function is called with these inputs, diff --git a/Sprint-3/2-practice-tdd/get-ordinal-number.test.js b/Sprint-3/2-practice-tdd/get-ordinal-number.test.js index adfa58560f..05d7c0ef48 100644 --- a/Sprint-3/2-practice-tdd/get-ordinal-number.test.js +++ b/Sprint-3/2-practice-tdd/get-ordinal-number.test.js @@ -10,7 +10,7 @@ const getOrdinalNumber = require("./get-ordinal-number"); // into meaningful categories. Then, select representative samples from each category to test. // This approach improves coverage and makes our tests easier to maintain. -// Case 1: Numbers ending with 1 (but not 11) +// Case 1: Numbers ending with 1 (but not 11). // When the number ends with 1, except those ending with 11, // Then the function should return a string by appending "st" to the number. test("should append 'st' for numbers ending with 1, except those ending with 11", () => { diff --git a/Sprint-3/2-practice-tdd/repeat-str.test.js b/Sprint-3/2-practice-tdd/repeat-str.test.js index a3fc1196c4..5956ed93b1 100644 --- a/Sprint-3/2-practice-tdd/repeat-str.test.js +++ b/Sprint-3/2-practice-tdd/repeat-str.test.js @@ -1,4 +1,4 @@ -// Implement a function repeatStr +// Implement a function repeatStr. const repeatStr = require("./repeat-str"); // Given a target string `str` and a positive integer `count`, // When the repeatStr function is called with these inputs, From 463d9774d7c977b278c99afe14dc32b0f7ed670c Mon Sep 17 00:00:00 2001 From: Alrzini2025 Date: Sat, 28 Feb 2026 15:30:57 +0000 Subject: [PATCH 5/6] correcting files for this work --- .../1-implement-and-rewrite-tests/implement/1-get-angle-type.js | 2 +- .../implement/2-is-proper-fraction.js | 2 +- .../1-implement-and-rewrite-tests/implement/3-get-card-value.js | 2 +- 3 files changed, 3 insertions(+), 3 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 bfc7ee13ae..9e05a871e2 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 @@ -32,6 +32,6 @@ function assertEquals(actualOutput, targetOutput) { } // TODO: Write tests to cover all cases, including boundary and invalid cases. -// Example: Identify Right Angles. +// Example: Identify Right Angles const right = getAngleType(90); assertEquals(right, "Right angle"); diff --git a/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js b/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js index 1bcd842041..970cb9b641 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 @@ -29,5 +29,5 @@ function assertEquals(actualOutput, targetOutput) { // TODO: Write tests to cover all cases. // What combinations of numerators and denominators should you test? -// Example: 1/2 is a proper fraction. +// Example: 1/2 is a proper fraction assertEquals(isProperFraction(1, 2), 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 3d897461e6..c7559e787e 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 @@ -45,7 +45,7 @@ assertEquals(getCardValue("9♠"), 9); 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) {} From bf6853233a632cbc8978f115d7f25f2c1e515ba7 Mon Sep 17 00:00:00 2001 From: Alrzini2025 Date: Tue, 17 Mar 2026 18:02:31 +0000 Subject: [PATCH 6/6] check the changes --- Sprint-3/2-practice-tdd/get-ordinal-number.js | 13 ++++++++++++- package.json | 6 +++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Sprint-3/2-practice-tdd/get-ordinal-number.js b/Sprint-3/2-practice-tdd/get-ordinal-number.js index f95d71db13..7f655e042c 100644 --- a/Sprint-3/2-practice-tdd/get-ordinal-number.js +++ b/Sprint-3/2-practice-tdd/get-ordinal-number.js @@ -1,5 +1,16 @@ function getOrdinalNumber(num) { - return "1st"; + const lastTwoDigits = num % 100; + const lastDigit = num % 10; + + if (lastTwoDigits >= 11 && lastTwoDigits <= 13) { + return `${num}th`; + } + + if (lastDigit === 1) return `${num}st`; + if (lastDigit === 2) return `${num}nd`; + if (lastDigit === 3) return `${num}rd`; + + return `${num}th`; } module.exports = getOrdinalNumber; diff --git a/package.json b/package.json index 0657e22dd8..6c91c8de47 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.3.0" } -} \ No newline at end of file +}