Skip to content

Commit cc80d7e

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

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,8 @@ test("should give a empty string when count is 0", () => {
4242
// Given a target string str and a negative integer count,
4343
// When the repeatStr function is called with these inputs,
4444
// Then it should throw an error or return an appropriate error message, as negative counts are not valid.
45+
test("should throw an error when count is negative", () => {
46+
const str = "hello"
47+
const count = -1;
48+
expect(() => repeat(str,count)).toThrow("Count must be a positive number");
49+
});

0 commit comments

Comments
 (0)