Skip to content

Commit 5e1196f

Browse files
test: add test case for returning original string when count is 0
1 parent 7455253 commit 5e1196f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ test("should return the original string when count is 1", () => {
3131
// Given a target string str and a count equal to 0,
3232
// When the repeatStr function is called with these inputs,
3333
// Then it should return an empty string, ensuring that a count of 0 results in an empty output.
34+
test("should give a empty string when count is 0", () => {
35+
const str = "hello";
36+
const count = 0;
37+
const repeatedStr = repeat(str, count);
38+
expect(repeatedStr).toEqual("");
39+
})
3440

3541
// case: Negative Count:
3642
// Given a target string str and a negative integer count,

0 commit comments

Comments
 (0)