Skip to content

Commit 021283e

Browse files
Add test for negative count in repeat-str
1 parent 297e964 commit 021283e

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎practice-tdd/repeat-str.test.js‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,8 @@ test("should return an empty string when count is 0", () => {
4040
// Given a target string `str` and a negative integer `count`,
4141
// When the repeatStr function is called with these inputs,
4242
// Then it should throw an error, as negative counts are not valid.
43+
test("should throw an error when count is negative", () => {
44+
const str = "hello";
45+
const count = -1;
46+
expect(() => repeatStr(str, count)).toThrow();
47+
});

0 commit comments

Comments
 (0)