From 32407f92f9fd0ce28e3fba5ec44b26a38b344a5e Mon Sep 17 00:00:00 2001 From: Hayriye Saricicek Date: Thu, 5 Mar 2026 09:52:22 +0000 Subject: [PATCH 01/17] Update .gitignore to include .vscode directory --- .gitignore | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index bde36e5302..a4da420804 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ node_modules .DS_Store -.vscode -**/.DS_Store \ No newline at end of file +.vscode/ +**/.DS_Store From 3f7a169adb570ccba1bad00b47b8f787c356bc44 Mon Sep 17 00:00:00 2001 From: Hayriye Saricicek Date: Mon, 9 Mar 2026 17:16:37 +0000 Subject: [PATCH 02/17] wrote function and tests for count --- Sprint-3/2-practice-tdd/count.js | 8 +++- Sprint-3/2-practice-tdd/count.test.js | 53 +++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/Sprint-3/2-practice-tdd/count.js b/Sprint-3/2-practice-tdd/count.js index 95b6ebb7d4..b3b0ce7508 100644 --- a/Sprint-3/2-practice-tdd/count.js +++ b/Sprint-3/2-practice-tdd/count.js @@ -1,5 +1,11 @@ function countChar(stringOfCharacters, findCharacter) { - return 5 + +let count = 0; +for (let char of stringOfCharacters) { + if (char === findCharacter) { + count++; + } } +return count; module.exports = countChar; diff --git a/Sprint-3/2-practice-tdd/count.test.js b/Sprint-3/2-practice-tdd/count.test.js index 179ea0ddf7..c78404432a 100644 --- a/Sprint-3/2-practice-tdd/count.test.js +++ b/Sprint-3/2-practice-tdd/count.test.js @@ -22,3 +22,56 @@ test("should count multiple occurrences of a character", () => { // And a character `char` that does not exist within `str`. // When the function is called with these inputs, // Then it should return 0, indicating that no occurrences of `char` were found. + +test("should count multiple occurrences of a character", () => { + const str = "aaaaa"; + const char = "a"; + const count = countChar(str, char); + expect(count).toEqual(5); +}); + +test("should count multiple occurrences of a character", () => { + const str = "blind"; + const char = "a"; + const count = countChar(str, char); + expect(count).toEqual(0); +}); + +test("should count multiple occurrences of a character", () => { + const str = "blood"; + const char = "o"; + const count = countChar(str, char); + expect(count).toEqual(2); +}); + +test("should count multiple occurrences of a character", () => { + const str = "blood"; + const char = "o"; + const count = countChar(str, char); + expect(count).toEqual(2); +}); + +test("should count multiple occurrences of a character", () => { + const str = "blood"; + const char = "l"; + const count = countChar(str, char); + expect(count).toEqual(1); +}); + +test("should count multiple occurrences of a character", () => { + const str = "bbbrf"; + const char = "b"; + const count = countChar(str, char); + expect(count).toEqual(3); +}); + +test("should count multiple occurrences of a character", () => { + const str = "ooooa"; + const char = "o"; + const count = countChar(str, char); + expect(count).toEqual(4); +}); + +// handling invalid input +// the tests work assuming that only letters are in the string +// numbers and special characters are not tested for From 2c8e6276fb4f315af3eb7b4d06cf217a73a26331 Mon Sep 17 00:00:00 2001 From: Hayriye Saricicek Date: Mon, 9 Mar 2026 21:15:17 +0000 Subject: [PATCH 03/17] wrote function and tests for ordinal numbers --- Sprint-3/2-practice-tdd/get-ordinal-number.js | 17 +++++++++- .../2-practice-tdd/get-ordinal-number.test.js | 32 +++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/Sprint-3/2-practice-tdd/get-ordinal-number.js b/Sprint-3/2-practice-tdd/get-ordinal-number.js index f95d71db13..e4acc65bd7 100644 --- a/Sprint-3/2-practice-tdd/get-ordinal-number.js +++ b/Sprint-3/2-practice-tdd/get-ordinal-number.js @@ -1,5 +1,20 @@ function getOrdinalNumber(num) { - return "1st"; + // Check if input is a number + if (typeof num !== "number" || isNaN(num)) { + throw new Error("Input must be a valid number"); + } + + const j = num % 10; // checks what last number is + const k = num % 100; // checks what last two numbers are, needed to check for 11 + + if (k === 11 || k === 12 || k === 13) { + return num + "th"; + } + if (j === 1) return num + "st"; + if (j === 2) return num + "nd"; + if (j === 3) return num + "rd"; + + return num + "th"; } module.exports = getOrdinalNumber; 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..6587afc5b2 100644 --- a/Sprint-3/2-practice-tdd/get-ordinal-number.test.js +++ b/Sprint-3/2-practice-tdd/get-ordinal-number.test.js @@ -13,8 +13,40 @@ const getOrdinalNumber = require("./get-ordinal-number"); // 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", () => { expect(getOrdinalNumber(1)).toEqual("1st"); expect(getOrdinalNumber(21)).toEqual("21st"); expect(getOrdinalNumber(131)).toEqual("131st"); }); + +// Case 2: Numbers ending with 2 +// When the number ends with 2, +// Then the function should return a string by appending "nd" to the number. + +test("should append 'nd' for numbers ending with 2", () => { + expect(getOrdinalNumber(2)).toEqual("2nd"); + expect(getOrdinalNumber(32)).toEqual("32nd"); + expect(getOrdinalNumber(252)).toEqual("252nd"); +}); + +// Case 3: Numbers ending with 3 +// When the number ends with 3, +// Then the function should return a string by appending "rd" to the number. + +test("should append 'rd' for numbers ending with 3", () => { + expect(getOrdinalNumber(3)).toEqual("3rd"); + expect(getOrdinalNumber(33)).toEqual("33rd"); + expect(getOrdinalNumber(133)).toEqual("133rd"); +}); + +// Case 4: The remaining numbers +// When the number ends with 1, except those ending with 11 +// For all other numbers +// Then the function should return a string by appending "th" to the number. + +test("should append 'th' for remaining numbers", () => { + expect(getOrdinalNumber(20)).toEqual("20th"); + expect(getOrdinalNumber(11)).toEqual("11th"); + expect(getOrdinalNumber(99)).toEqual("99th"); +}); From 3217cc5624c1211ebd565e17906cad30e0921ec6 Mon Sep 17 00:00:00 2001 From: Hayriye Saricicek Date: Tue, 10 Mar 2026 11:33:08 +0000 Subject: [PATCH 04/17] tests and function to repeat string --- Sprint-3/2-practice-tdd/repeat-str.js | 12 ++++++++++-- Sprint-3/2-practice-tdd/repeat-str.test.js | 22 +++++++++++++++++++++- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/Sprint-3/2-practice-tdd/repeat-str.js b/Sprint-3/2-practice-tdd/repeat-str.js index 3838c7b003..7a21885ad2 100644 --- a/Sprint-3/2-practice-tdd/repeat-str.js +++ b/Sprint-3/2-practice-tdd/repeat-str.js @@ -1,5 +1,13 @@ -function repeatStr() { - return "hellohellohello"; +function repeatStr(str, count) { + if (count < 0) { + throw new Error("Count must be positive"); + } + + if (count === 0) { + return " "; + } + + return str.repeat(count); } module.exports = repeatStr; diff --git a/Sprint-3/2-practice-tdd/repeat-str.test.js b/Sprint-3/2-practice-tdd/repeat-str.test.js index a3fc1196c4..f4ba53e10a 100644 --- a/Sprint-3/2-practice-tdd/repeat-str.test.js +++ b/Sprint-3/2-practice-tdd/repeat-str.test.js @@ -21,12 +21,32 @@ test("should repeat the string count times", () => { // When the repeatStr function is called with these inputs, // Then it should return the original `str` without repetition. +test("should repeat the string count times", () => { + const str = "hello"; + const count = 1; + const repeatedStr = repeatStr(str, count); + expect(repeatedStr).toEqual("hello"); +}); + // Case: Handle count of 0: // Given a target string `str` and a `count` equal to 0, -// When the repeatStr function is called with these inputs, +// When the repeatStr function is called with these inputs // Then it should return an empty string. +test("should repeat the string count times", () => { + const str = "hello"; + const count = 0; + const repeatedStr = repeatStr(str, count); + expect(repeatedStr).toEqual(" "); +}); + // Case: Handle negative count: // Given a target string `str` and a negative integer `count`, // When the repeatStr function is called with these inputs, // Then it should throw an error, as negative counts are not valid. + +test("should throw an error when count is negative", () => { + const str = "hello"; + const count = -3; + expect(() => repeatStr(str, count)).toThrow("Count must be positive"); +}); From 7f767954835fd39ce42a960aa5075cb5cfce66b2 Mon Sep 17 00:00:00 2001 From: Hayriye Saricicek Date: Sat, 14 Mar 2026 16:08:38 +0000 Subject: [PATCH 05/17] Grouped tests together for count.test --- Sprint-3/2-practice-tdd/count.test.js | 54 ++++----------------------- 1 file changed, 7 insertions(+), 47 deletions(-) diff --git a/Sprint-3/2-practice-tdd/count.test.js b/Sprint-3/2-practice-tdd/count.test.js index c78404432a..3e8d77ea89 100644 --- a/Sprint-3/2-practice-tdd/count.test.js +++ b/Sprint-3/2-practice-tdd/count.test.js @@ -24,53 +24,13 @@ test("should count multiple occurrences of a character", () => { // Then it should return 0, indicating that no occurrences of `char` were found. test("should count multiple occurrences of a character", () => { - const str = "aaaaa"; - const char = "a"; - const count = countChar(str, char); - expect(count).toEqual(5); -}); - -test("should count multiple occurrences of a character", () => { - const str = "blind"; - const char = "a"; - const count = countChar(str, char); - expect(count).toEqual(0); -}); - -test("should count multiple occurrences of a character", () => { - const str = "blood"; - const char = "o"; - const count = countChar(str, char); - expect(count).toEqual(2); -}); - -test("should count multiple occurrences of a character", () => { - const str = "blood"; - const char = "o"; - const count = countChar(str, char); - expect(count).toEqual(2); -}); - -test("should count multiple occurrences of a character", () => { - const str = "blood"; - const char = "l"; - const count = countChar(str, char); - expect(count).toEqual(1); -}); - -test("should count multiple occurrences of a character", () => { - const str = "bbbrf"; - const char = "b"; - const count = countChar(str, char); - expect(count).toEqual(3); -}); - -test("should count multiple occurrences of a character", () => { - const str = "ooooa"; - const char = "o"; - const count = countChar(str, char); - expect(count).toEqual(4); -}); + expect(countChar("aaaaa", 'b")).toEqual(5); + expect(countChar("blind", 'a)).toEqual(0); + expect(countChar("blood", 'o")).toEqual(2); + expect(countChar("bbbrf", 'b")).toEqual(3); + expect(countChar("ooooa", 'o")).toEqual(4); +}); + // handling invalid input // the tests work assuming that only letters are in the string From 01e4e00d75d28eeab32567d1397f921ef0d81d96 Mon Sep 17 00:00:00 2001 From: Hayriye Saricicek Date: Sat, 14 Mar 2026 16:32:02 +0000 Subject: [PATCH 06/17] added tests and renamed variable --- Sprint-3/2-practice-tdd/get-ordinal-number.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Sprint-3/2-practice-tdd/get-ordinal-number.js b/Sprint-3/2-practice-tdd/get-ordinal-number.js index e4acc65bd7..961a85de65 100644 --- a/Sprint-3/2-practice-tdd/get-ordinal-number.js +++ b/Sprint-3/2-practice-tdd/get-ordinal-number.js @@ -1,18 +1,18 @@ function getOrdinalNumber(num) { // Check if input is a number - if (typeof num !== "number" || isNaN(num)) { + if (typeof num !== "number" || isNaN(num)) || !Number.isInteger(num) || !Number.isFinite(num)) { throw new Error("Input must be a valid number"); } - const j = num % 10; // checks what last number is - const k = num % 100; // checks what last two numbers are, needed to check for 11 + const lastnum = num % 10; // checks what last number is + const last2num = % 100; // checks what last two numbers are, needed to check for 11 - if (k === 11 || k === 12 || k === 13) { + if (last2num === 11 || last2num === 12 || last2num === 13) { return num + "th"; } - if (j === 1) return num + "st"; - if (j === 2) return num + "nd"; - if (j === 3) return num + "rd"; + if (lastnum === 1) return num + "st"; + if (lastnum === 2) return num + "nd"; + if (lastnum === 3) return num + "rd"; return num + "th"; } From 760420404ac8190b3dc391ad2391f094f0ced7c3 Mon Sep 17 00:00:00 2001 From: Hayriye Saricicek Date: Sat, 14 Mar 2026 16:56:33 +0000 Subject: [PATCH 07/17] updated description --- Sprint-3/2-practice-tdd/get-ordinal-number.test.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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 6587afc5b2..d3b524e297 100644 --- a/Sprint-3/2-practice-tdd/get-ordinal-number.test.js +++ b/Sprint-3/2-practice-tdd/get-ordinal-number.test.js @@ -41,11 +41,10 @@ test("should append 'rd' for numbers ending with 3", () => { }); // Case 4: The remaining numbers -// When the number ends with 1, except those ending with 11 -// For all other numbers -// Then the function should return a string by appending "th" to the number. +// For numbers that don't end in 1 (not11), 2 and 3 +// the function should return a string by appending "th" to the number. -test("should append 'th' for remaining numbers", () => { +test("should append 'th' if nunber is 11 or does not end in 1, 2 or 3 ", () => { expect(getOrdinalNumber(20)).toEqual("20th"); expect(getOrdinalNumber(11)).toEqual("11th"); expect(getOrdinalNumber(99)).toEqual("99th"); From ebfb090fa0435b82cae1fc8a92e0caf5470e9ab6 Mon Sep 17 00:00:00 2001 From: Hayriye Saricicek Date: Sat, 14 Mar 2026 17:27:31 +0000 Subject: [PATCH 08/17] made descriptions more informative --- Sprint-3/2-practice-tdd/repeat-str.test.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Sprint-3/2-practice-tdd/repeat-str.test.js b/Sprint-3/2-practice-tdd/repeat-str.test.js index f4ba53e10a..f56c9b01e2 100644 --- a/Sprint-3/2-practice-tdd/repeat-str.test.js +++ b/Sprint-3/2-practice-tdd/repeat-str.test.js @@ -5,9 +5,9 @@ const repeatStr = require("./repeat-str"); // Then it should: // Case: handle multiple repetitions: -// Given a target string `str` and a positive integer `count` greater than 1, -// When the repeatStr function is called with these inputs, -// Then it should return a string that contains the original `str` repeated `count` times. +// A string is repeated count number of times +// If a string is "hello" and count is 3 then +// the hello will be output 3 times with no spaces between test("should repeat the string count times", () => { const str = "hello"; @@ -17,9 +17,9 @@ test("should repeat the string count times", () => { }); // Case: handle count of 1: -// Given a target string `str` and a `count` equal to 1, -// When the repeatStr function is called with these inputs, -// Then it should return the original `str` without repetition. +// If count is 1 then the string is not repeated and +// will be output for example if the string is "Hello" +// then the output will be "Hello" test("should repeat the string count times", () => { const str = "hello"; @@ -29,9 +29,8 @@ test("should repeat the string count times", () => { }); // Case: Handle count of 0: -// Given a target string `str` and a `count` equal to 0, -// When the repeatStr function is called with these inputs -// Then it should return an empty string. +// If the the string is empty then count will be 0 +// and an empty string will be returned test("should repeat the string count times", () => { const str = "hello"; From e4de3c6d1a5ac465cc36b3ee58969e201a2acf00 Mon Sep 17 00:00:00 2001 From: Hayriye Saricicek Date: Sat, 14 Mar 2026 17:50:10 +0000 Subject: [PATCH 09/17] added curly bracket --- Sprint-3/2-practice-tdd/count.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Sprint-3/2-practice-tdd/count.js b/Sprint-3/2-practice-tdd/count.js index b3b0ce7508..e10b6cf0f7 100644 --- a/Sprint-3/2-practice-tdd/count.js +++ b/Sprint-3/2-practice-tdd/count.js @@ -1,11 +1,12 @@ function countChar(stringOfCharacters, findCharacter) { - -let count = 0; -for (let char of stringOfCharacters) { - if (char === findCharacter) { - count++; + let count = 0; + for (let char of stringOfCharacters) { + if (char === findCharacter) { + count++; + } } + + return count; } -return count; module.exports = countChar; From 11c83466ddfb6f85d889f1477f5dc7fba488ec52 Mon Sep 17 00:00:00 2001 From: Hayriye Saricicek Date: Sun, 15 Mar 2026 18:40:19 +0000 Subject: [PATCH 10/17] Corrected syntax errors and indentation --- Sprint-3/2-practice-tdd/count.test.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Sprint-3/2-practice-tdd/count.test.js b/Sprint-3/2-practice-tdd/count.test.js index 3e8d77ea89..14e372ee60 100644 --- a/Sprint-3/2-practice-tdd/count.test.js +++ b/Sprint-3/2-practice-tdd/count.test.js @@ -24,13 +24,12 @@ test("should count multiple occurrences of a character", () => { // Then it should return 0, indicating that no occurrences of `char` were found. test("should count multiple occurrences of a character", () => { - expect(countChar("aaaaa", 'b")).toEqual(5); - expect(countChar("blind", 'a)).toEqual(0); - expect(countChar("blood", 'o")).toEqual(2); - expect(countChar("bbbrf", 'b")).toEqual(3); - expect(countChar("ooooa", 'o")).toEqual(4); -}); - + expect(countChar("aaaaa", "b")).toEqual(5); + expect(countChar("blind", "a")).toEqual(0); + expect(countChar("blood", "o")).toEqual(2); + expect(countChar("bbbrf", "b")).toEqual(3); + expect(countChar("ooooa", "o")).toEqual(4); +}); // handling invalid input // the tests work assuming that only letters are in the string From e94715041799fbedba0be857d135a74565ed2ecc Mon Sep 17 00:00:00 2001 From: Hayriye Saricicek Date: Sun, 15 Mar 2026 19:20:21 +0000 Subject: [PATCH 11/17] removed redundant checks and added check for negative values --- Sprint-3/2-practice-tdd/get-ordinal-number.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sprint-3/2-practice-tdd/get-ordinal-number.js b/Sprint-3/2-practice-tdd/get-ordinal-number.js index 961a85de65..4ccd053307 100644 --- a/Sprint-3/2-practice-tdd/get-ordinal-number.js +++ b/Sprint-3/2-practice-tdd/get-ordinal-number.js @@ -1,11 +1,11 @@ function getOrdinalNumber(num) { // Check if input is a number - if (typeof num !== "number" || isNaN(num)) || !Number.isInteger(num) || !Number.isFinite(num)) { + if (!Number.isInteger(num) || !Number.isFinite(num) || num <= 0) { throw new Error("Input must be a valid number"); } const lastnum = num % 10; // checks what last number is - const last2num = % 100; // checks what last two numbers are, needed to check for 11 + const last2num = num % 100; // checks what last two numbers are, needed to check for 11 if (last2num === 11 || last2num === 12 || last2num === 13) { return num + "th"; From f55e9b5fd033d0c1842d2b2631121540c8bb434d Mon Sep 17 00:00:00 2001 From: Hayriye Saricicek Date: Sun, 15 Mar 2026 19:33:02 +0000 Subject: [PATCH 12/17] made variables into camelCase and shortened the code for checking 11, 12,13 --- Sprint-3/2-practice-tdd/get-ordinal-number.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Sprint-3/2-practice-tdd/get-ordinal-number.js b/Sprint-3/2-practice-tdd/get-ordinal-number.js index 4ccd053307..57c5d1ade5 100644 --- a/Sprint-3/2-practice-tdd/get-ordinal-number.js +++ b/Sprint-3/2-practice-tdd/get-ordinal-number.js @@ -4,15 +4,15 @@ function getOrdinalNumber(num) { throw new Error("Input must be a valid number"); } - const lastnum = num % 10; // checks what last number is - const last2num = num % 100; // checks what last two numbers are, needed to check for 11 + const lastNum = num % 10; // checks what last number is + const last2Num = num % 100; // checks what last two numbers are, needed to check for 11 - if (last2num === 11 || last2num === 12 || last2num === 13) { + if (last2Num >= 11 && last2Num <= 13) { return num + "th"; } - if (lastnum === 1) return num + "st"; - if (lastnum === 2) return num + "nd"; - if (lastnum === 3) return num + "rd"; + if (lastNum === 1) return num + "st"; + if (lastNum === 2) return num + "nd"; + if (lastNum === 3) return num + "rd"; return num + "th"; } From ebe2c5ddd84ad153540c4de85dc3e5f40bded988 Mon Sep 17 00:00:00 2001 From: Hayriye Saricicek Date: Sun, 15 Mar 2026 20:07:23 +0000 Subject: [PATCH 13/17] updated description of appending th --- Sprint-3/2-practice-tdd/count.test.js | 2 +- Sprint-3/2-practice-tdd/get-ordinal-number.test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sprint-3/2-practice-tdd/count.test.js b/Sprint-3/2-practice-tdd/count.test.js index 14e372ee60..c3fd8ec5e5 100644 --- a/Sprint-3/2-practice-tdd/count.test.js +++ b/Sprint-3/2-practice-tdd/count.test.js @@ -24,7 +24,7 @@ test("should count multiple occurrences of a character", () => { // Then it should return 0, indicating that no occurrences of `char` were found. test("should count multiple occurrences of a character", () => { - expect(countChar("aaaaa", "b")).toEqual(5); + expect(countChar("aaaaa", "a")).toEqual(5); expect(countChar("blind", "a")).toEqual(0); expect(countChar("blood", "o")).toEqual(2); expect(countChar("bbbrf", "b")).toEqual(3); 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 d3b524e297..6c8f26ad54 100644 --- a/Sprint-3/2-practice-tdd/get-ordinal-number.test.js +++ b/Sprint-3/2-practice-tdd/get-ordinal-number.test.js @@ -44,7 +44,7 @@ test("should append 'rd' for numbers ending with 3", () => { // For numbers that don't end in 1 (not11), 2 and 3 // the function should return a string by appending "th" to the number. -test("should append 'th' if nunber is 11 or does not end in 1, 2 or 3 ", () => { +test("should append 'th' if number is 11, 12 or 13 or does not end in 1, 2 or 3",() => { expect(getOrdinalNumber(20)).toEqual("20th"); expect(getOrdinalNumber(11)).toEqual("11th"); expect(getOrdinalNumber(99)).toEqual("99th"); From daec4036a645750cd7ee40d9343aca7a55b565e6 Mon Sep 17 00:00:00 2001 From: Hayriye Saricicek Date: Sun, 15 Mar 2026 20:13:04 +0000 Subject: [PATCH 14/17] updated description for clarity --- Sprint-3/2-practice-tdd/repeat-str.test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sprint-3/2-practice-tdd/repeat-str.test.js b/Sprint-3/2-practice-tdd/repeat-str.test.js index f56c9b01e2..79d22b89dd 100644 --- a/Sprint-3/2-practice-tdd/repeat-str.test.js +++ b/Sprint-3/2-practice-tdd/repeat-str.test.js @@ -9,7 +9,7 @@ const repeatStr = require("./repeat-str"); // If a string is "hello" and count is 3 then // the hello will be output 3 times with no spaces between -test("should repeat the string count times", () => { +test("when count equals 3 it should repeat the string 3 times without spaces", () => { const str = "hello"; const count = 3; const repeatedStr = repeatStr(str, count); @@ -21,7 +21,7 @@ test("should repeat the string count times", () => { // will be output for example if the string is "Hello" // then the output will be "Hello" -test("should repeat the string count times", () => { +test("when count equals 1 it produce the string", () => { const str = "hello"; const count = 1; const repeatedStr = repeatStr(str, count); @@ -32,7 +32,7 @@ test("should repeat the string count times", () => { // If the the string is empty then count will be 0 // and an empty string will be returned -test("should repeat the string count times", () => { +test("when count equals 0 it should produce an empty string", () => { const str = "hello"; const count = 0; const repeatedStr = repeatStr(str, count); From 514a9da8bdfeb0cd596a48af1e54494488fe0c22 Mon Sep 17 00:00:00 2001 From: Hayriye Saricicek Date: Mon, 16 Mar 2026 00:36:33 +0000 Subject: [PATCH 15/17] Changed description for the append --- Sprint-3/2-practice-tdd/get-ordinal-number.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 6c8f26ad54..dea2de5f91 100644 --- a/Sprint-3/2-practice-tdd/get-ordinal-number.test.js +++ b/Sprint-3/2-practice-tdd/get-ordinal-number.test.js @@ -41,10 +41,10 @@ test("should append 'rd' for numbers ending with 3", () => { }); // Case 4: The remaining numbers -// For numbers that don't end in 1 (not11), 2 and 3 +// For numbers ending in 0, 4, 5, 6, 7, 8, 9, 11, 12, 13 // the function should return a string by appending "th" to the number. -test("should append 'th' if number is 11, 12 or 13 or does not end in 1, 2 or 3",() => { +test("should append 'th' if number is ending in 0, 4, 5,6, 7, 8, 9, 10, 11, 12 or 13", () => { expect(getOrdinalNumber(20)).toEqual("20th"); expect(getOrdinalNumber(11)).toEqual("11th"); expect(getOrdinalNumber(99)).toEqual("99th"); From 1efb9a9b34373dd7483cec06d1028993a3012032 Mon Sep 17 00:00:00 2001 From: Hayriye Saricicek Date: Mon, 16 Mar 2026 00:40:22 +0000 Subject: [PATCH 16/17] clarified --- Sprint-3/2-practice-tdd/get-ordinal-number.test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 dea2de5f91..983476645f 100644 --- a/Sprint-3/2-practice-tdd/get-ordinal-number.test.js +++ b/Sprint-3/2-practice-tdd/get-ordinal-number.test.js @@ -14,7 +14,7 @@ const getOrdinalNumber = require("./get-ordinal-number"); // 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", () => { +test("should append 'st' for numbers ending with 1, except 11", () => { expect(getOrdinalNumber(1)).toEqual("1st"); expect(getOrdinalNumber(21)).toEqual("21st"); expect(getOrdinalNumber(131)).toEqual("131st"); @@ -24,7 +24,7 @@ test("should append 'st' for numbers ending with 1, except those ending with 11" // When the number ends with 2, // Then the function should return a string by appending "nd" to the number. -test("should append 'nd' for numbers ending with 2", () => { +test("should append 'nd' for numbers ending with 2 except 12", () => { expect(getOrdinalNumber(2)).toEqual("2nd"); expect(getOrdinalNumber(32)).toEqual("32nd"); expect(getOrdinalNumber(252)).toEqual("252nd"); @@ -34,7 +34,7 @@ test("should append 'nd' for numbers ending with 2", () => { // When the number ends with 3, // Then the function should return a string by appending "rd" to the number. -test("should append 'rd' for numbers ending with 3", () => { +test("should append 'rd' for numbers ending with 3 except 13", () => { expect(getOrdinalNumber(3)).toEqual("3rd"); expect(getOrdinalNumber(33)).toEqual("33rd"); expect(getOrdinalNumber(133)).toEqual("133rd"); From 659e4b24c30bc46429183d0bf508d9c326bc1144 Mon Sep 17 00:00:00 2001 From: Hayriye Saricicek Date: Mon, 16 Mar 2026 00:44:38 +0000 Subject: [PATCH 17/17] changed test description --- Sprint-3/2-practice-tdd/repeat-str.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-3/2-practice-tdd/repeat-str.test.js b/Sprint-3/2-practice-tdd/repeat-str.test.js index 79d22b89dd..21f1102ada 100644 --- a/Sprint-3/2-practice-tdd/repeat-str.test.js +++ b/Sprint-3/2-practice-tdd/repeat-str.test.js @@ -32,7 +32,7 @@ test("when count equals 1 it produce the string", () => { // If the the string is empty then count will be 0 // and an empty string will be returned -test("when count equals 0 it should produce an empty string", () => { +test("should return an empty string when count = 0 ", () => { const str = "hello"; const count = 0; const repeatedStr = repeatStr(str, count);