Skip to content

Commit e18e1dc

Browse files
committed
added more test cases for "goodbye"
1 parent 051fef8 commit e18e1dc

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,24 @@ test("should repeat the string count times", () => {
5656
const count = 5;
5757
const repeatedStr = repeatStr(str, count);
5858
expect(repeatedStr).toEqual("goodbyegoodbyegoodbyegoodbyegoodbye");
59+
});
60+
61+
test("should repeat the string count times", () => {
62+
const str = "goodbye";
63+
const count = 1;
64+
const repeatedStr = repeatStr(str, count);
65+
expect(repeatedStr).toEqual("goodbye");
66+
});
67+
68+
test("should repeat the string count times", () => {
69+
const str = "goodbye";
70+
const count = 0;
71+
const repeatedStr = repeatStr(str, count);
72+
expect(repeatedStr).toEqual("");
73+
});
74+
75+
test("should throw new error 'count could not be negative' when number of count <0", () => {
76+
const str = "goodbye";
77+
const count = -2; () =>
78+
expect(repeatStr).toThrow("count could not be negative");
5979
});

0 commit comments

Comments
 (0)