Skip to content

Commit 1cfaf94

Browse files
committed
Add more test for an empty string.
1 parent 3dc912b commit 1cfaf94

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,13 @@ test("should throw an error", () => {
5858
const count = -1;
5959
expect(() => repeatStr(str, count)).toThrow("Count must not be negative");
6060
});
61+
62+
// Case: Handle negative count:
63+
// Given a target empty string `str` and a negative integer `count`,
64+
// When the repeatStr function is called with these inputs,
65+
// Then it should throw an error, as negative counts are not valid.
66+
test("should throw an error", () => {
67+
const str = "";
68+
const count = -1;
69+
expect(() => repeatStr(str, count)).toThrow("Count must not be negative");
70+
});

0 commit comments

Comments
 (0)