Skip to content

Commit c456e28

Browse files
committed
add an error message and removed the commented code on line 48
1 parent 23a26c6 commit c456e28

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ function repeatStr(str, count) {
22
if (count >= 0) {
33
return str.repeat(count);
44
} else {
5-
throw new Error("");
5+
throw new Error("Count must be a non-negative number.");
66
}
77
}
88

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ test("should return an empty string when count == 0", () => {
4545
test("should throw an error", () => {
4646
const str = "responsibility";
4747
const count = -5;
48-
// const repeatedStr = repeatStr(str, count);
49-
// In order for it to work, 'the fuction' itself should directly be passed to 'expect'.
50-
// Moreover, the function should be wrapped in a function call so jest can run it
48+
5149
expect(() => repeatStr(str, count)).toThrow();
5250
})

0 commit comments

Comments
 (0)