Skip to content

Commit 4d31f44

Browse files
committed
Resolved merge conflict: kept repeat.js
2 parents 7da75fd + 5dc9452 commit 4d31f44

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

Sprint-3/2-practice-tdd/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ Write the tests _before_ the code that will make them pass.
99
Recommended order:
1010

1111
1. `count.test.js`
12-
1. `repeat.test.js`
12+
1. `repeat-str.test.js`
1313
1. `get-ordinal-number.test.js`
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
function repeatStr() {
2+
return "hellohellohello";
3+
}
4+
5+
module.exports = repeatStr;

Sprint-3/2-practice-tdd/repeat.test.js renamed to Sprint-3/2-practice-tdd/repeat-str.test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// Implement a function repeat
2-
const repeat = require("./repeat");
1+
// Implement a function repeatStr
2+
const repeatStr = require("./repeat-str");
33
// 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,
55
// Then it should:
66
function repeat(str, count) {
77
if (count < 0) {
@@ -14,29 +14,29 @@ module.exports = repeat;
1414

1515
// case: repeat String:
1616
// Given a target string str and a positive integer count,
17-
// When the repeat function is called with these inputs,
17+
// When the repeatStr function is called with these inputs,
1818
// Then it should repeat the str count times and return a new string containing the repeated str values.
1919

2020
test("should repeat the string count times", () => {
2121
const str = "hello";
2222
const count = 3;
23-
const repeatedStr = repeat(str, count);
23+
const repeatedStr = repeatStr(str, count);
2424
expect(repeatedStr).toEqual("hellohellohello");
2525
});
2626

2727
// case: handle Count of 1:
2828
// Given a target string str and a count equal to 1,
29-
// When the repeat function is called with these inputs,
29+
// When the repeatStr function is called with these inputs,
3030
// Then it should return the original str without repetition, ensuring that a count of 1 results in no repetition.
3131

3232
// case: Handle Count of 0:
3333
// Given a target string str and a count equal to 0,
34-
// When the repeat function is called with these inputs,
34+
// When the repeatStr function is called with these inputs,
3535
// Then it should return an empty string, ensuring that a count of 0 results in an empty output.
3636

3737
// case: Negative Count:
3838
// Given a target string str and a negative integer count,
39-
// When the repeat function is called with these inputs,
39+
// When the repeatStr function is called with these inputs,
4040
// Then it should throw an error or return an appropriate error message, as negative counts are not valid.
4141
const repeat = require("./repeat");
4242

0 commit comments

Comments
 (0)