Skip to content

Commit fd06505

Browse files
wrote a test case for count equal to 0 to return empty string
1 parent f510445 commit fd06505

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ test("should return the original string when count is 1", () => {
3434
// When the repeatStr function is called with these inputs,
3535
// Then it should return an empty string.
3636

37+
test("should return an empty string when count is 0", () => {
38+
const str = "hello";
39+
const count = 0;
40+
const repeatedStr = repeatStr(str, count);
41+
expect(repeatedStr).toEqual("");
42+
});
43+
3744
// Case: Handle negative count:
3845
// Given a target string `str` and a negative integer `count`,
3946
// When the repeatStr function is called with these inputs,

0 commit comments

Comments
 (0)