|
1 | | -// Implement a function repeat |
2 | | -const repeat = require("./repeat"); |
| 1 | +// Implement a function repeatStr |
| 2 | +const repeatStr = require("./repeat-str"); |
3 | 3 | // Given a target string str and a positive integer count, |
4 | | -// When the repeat function is called with these inputs, |
| 4 | +// When the repeatStr function is called with these inputs, |
5 | 5 | // Then it should: |
6 | 6 |
|
7 | 7 | // case: repeat String: |
8 | 8 | // Given a target string str and a positive integer count, |
9 | | -// When the repeat function is called with these inputs, |
| 9 | +// When the repeatStr function is called with these inputs, |
10 | 10 | // Then it should repeat the str count times and return a new string containing the repeated str values. |
11 | 11 |
|
12 | 12 | test("should repeat the string count times", () => { |
13 | 13 | const str = "hello"; |
14 | 14 | const count = 3; |
15 | | - const repeatedStr = repeat(str, count); |
| 15 | + const repeatedStr = repeatStr(str, count); |
16 | 16 | expect(repeatedStr).toEqual("hellohellohello"); |
17 | 17 | }); |
18 | 18 |
|
19 | 19 | // case: handle Count of 1: |
20 | 20 | // Given a target string str and a count equal to 1, |
21 | | -// When the repeat function is called with these inputs, |
| 21 | +// When the repeatStr function is called with these inputs, |
22 | 22 | // Then it should return the original str without repetition, ensuring that a count of 1 results in no repetition. |
23 | 23 |
|
24 | 24 | // case: Handle Count of 0: |
25 | 25 | // Given a target string str and a count equal to 0, |
26 | | -// When the repeat function is called with these inputs, |
| 26 | +// When the repeatStr function is called with these inputs, |
27 | 27 | // Then it should return an empty string, ensuring that a count of 0 results in an empty output. |
28 | 28 |
|
29 | 29 | // case: Negative Count: |
30 | 30 | // Given a target string str and a negative integer count, |
31 | | -// When the repeat function is called with these inputs, |
| 31 | +// When the repeatStr function is called with these inputs, |
32 | 32 | // Then it should throw an error or return an appropriate error message, as negative counts are not valid. |
0 commit comments