Skip to content

Commit f6314c3

Browse files
committed
function repeat() should return false when negative number passed
1 parent c0d9240 commit f6314c3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function repeat(str, count) {
22
if(count < 0) {
3-
return "Error: Negative counts are not valid.";
3+
return false;
44
}
55
return str.repeat(count);
66
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ test("should repeat the string 0 times ( means the output will be an empty strin
4646
const str = "hello";
4747
const count = -3;
4848
const repeatedStr = repeat(str, count);
49-
expect(repeatedStr).toEqual("Error: Negative counts are not valid.");
49+
expect(repeatedStr).toEqual(false);
5050
});

0 commit comments

Comments
 (0)