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 70% rename from Sprint-3/2-practice-tdd/repeat.test.js rename to Sprint-3/2-practice-tdd/repeat-str.test.js index 34097b09c..fc59d019e 100644 --- a/Sprint-3/2-practice-tdd/repeat.test.js +++ b/Sprint-3/2-practice-tdd/repeat-str.test.js @@ -1,32 +1,32 @@ -// Implement a function repeat -const repeat = require("./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", () => { const str = "hello"; const count = 3; - const repeatedStr = repeat(str, count); + const repeatedStr = repeatStr(str, count); expect(repeatedStr).toEqual("hellohellohello"); }); // 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. 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;