Skip to content

Commit 08dccc1

Browse files
committed
wrote a test that throws error when string is empty
1 parent 3463aee commit 08dccc1

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎practice-tdd/repeat-str.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ export function repeatStr(str, count) {
66
let repeatedStr = str;
77
count = Math.floor(count);
88

9+
if (str === " ") {
10+
throw new Error("String shoild not be empty");
11+
}
912
if (count < 0) {
1013
throw new Error("Negative counts are not valid");
1114
}

0 commit comments

Comments
 (0)