From c4b0c07451d02a7213498d5c40260c4df5b04c4b Mon Sep 17 00:00:00 2001 From: jennethydyrova Date: Thu, 30 Oct 2025 13:01:23 +0000 Subject: [PATCH 1/2] rename repeat function to make its purpose more clear --- Sprint-3/2-practice-tdd/README.md | 2 +- Sprint-3/2-practice-tdd/repeat-str.js | 5 +++++ .../2-practice-tdd/{repeat.test.js => repeat-str.test.js} | 4 ++-- Sprint-3/2-practice-tdd/repeat.js | 5 ----- 4 files changed, 8 insertions(+), 8 deletions(-) create mode 100644 Sprint-3/2-practice-tdd/repeat-str.js rename Sprint-3/2-practice-tdd/{repeat.test.js => repeat-str.test.js} (93%) delete mode 100644 Sprint-3/2-practice-tdd/repeat.js diff --git a/Sprint-3/2-practice-tdd/README.md b/Sprint-3/2-practice-tdd/README.md index ff28c131c..f7d82fe43 100644 --- a/Sprint-3/2-practice-tdd/README.md +++ b/Sprint-3/2-practice-tdd/README.md @@ -9,5 +9,5 @@ Write the tests _before_ the code that will make them pass. Recommended order: 1. `count.test.js` -1. `repeat.test.js` +1. `repeat-str.test.js` 1. `get-ordinal-number.test.js` diff --git a/Sprint-3/2-practice-tdd/repeat-str.js b/Sprint-3/2-practice-tdd/repeat-str.js new file mode 100644 index 000000000..3838c7b00 --- /dev/null +++ b/Sprint-3/2-practice-tdd/repeat-str.js @@ -0,0 +1,5 @@ +function repeatStr() { + return "hellohellohello"; +} + +module.exports = repeatStr; diff --git a/Sprint-3/2-practice-tdd/repeat.test.js b/Sprint-3/2-practice-tdd/repeat-str.test.js similarity index 93% rename from Sprint-3/2-practice-tdd/repeat.test.js rename to Sprint-3/2-practice-tdd/repeat-str.test.js index 34097b09c..2496ac059 100644 --- a/Sprint-3/2-practice-tdd/repeat.test.js +++ b/Sprint-3/2-practice-tdd/repeat-str.test.js @@ -1,5 +1,5 @@ // Implement a function repeat -const repeat = require("./repeat"); +const repeatStr = require("./repeat-str"); // Given a target string str and a positive integer count, // When the repeat function is called with these inputs, // Then it should: @@ -12,7 +12,7 @@ const repeat = require("./repeat"); test("should repeat the string count times", () => { const str = "hello"; const count = 3; - const repeatedStr = repeat(str, count); + const repeatedStr = repeatStr(str, count); expect(repeatedStr).toEqual("hellohellohello"); }); diff --git a/Sprint-3/2-practice-tdd/repeat.js b/Sprint-3/2-practice-tdd/repeat.js deleted file mode 100644 index 00e60d7f3..000000000 --- a/Sprint-3/2-practice-tdd/repeat.js +++ /dev/null @@ -1,5 +0,0 @@ -function repeat() { - return "hellohellohello"; -} - -module.exports = repeat; From 51116dc7375232c0b8eaa1e73f263df353ad01bb Mon Sep 17 00:00:00 2001 From: jennethydyrova Date: Thu, 30 Oct 2025 13:04:02 +0000 Subject: [PATCH 2/2] update comments --- Sprint-3/2-practice-tdd/repeat-str.test.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Sprint-3/2-practice-tdd/repeat-str.test.js b/Sprint-3/2-practice-tdd/repeat-str.test.js index 2496ac059..fc59d019e 100644 --- a/Sprint-3/2-practice-tdd/repeat-str.test.js +++ b/Sprint-3/2-practice-tdd/repeat-str.test.js @@ -1,12 +1,12 @@ -// Implement a function repeat +// Implement a function repeatStr const repeatStr = require("./repeat-str"); // Given a target string str and a positive integer count, -// When the repeat function is called with these inputs, +// When the repeatStr function is called with these inputs, // Then it should: // case: repeat String: // Given a target string str and a positive integer count, -// When the repeat function is called with these inputs, +// When the repeatStr function is called with these inputs, // Then it should repeat the str count times and return a new string containing the repeated str values. test("should repeat the string count times", () => { @@ -18,15 +18,15 @@ 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 repeat function is called with these inputs, +// When the repeatStr function is called with these inputs, // Then it should return the original str without repetition, ensuring that a count of 1 results in no repetition. // case: Handle Count of 0: // Given a target string str and a count equal to 0, -// When the repeat function is called with these inputs, +// When the repeatStr function is called with these inputs, // Then it should return an empty string, ensuring that a count of 0 results in an empty output. // case: Negative Count: // Given a target string str and a negative integer count, -// When the repeat function is called with these inputs, +// When the repeatStr function is called with these inputs, // Then it should throw an error or return an appropriate error message, as negative counts are not valid.