@@ -4,6 +4,30 @@ const repeatStr = require("./repeat-str");
44// When the repeatStr function is called with these inputs,
55// Then it should:
66
7+ // Case: Handle count of 0:
8+ // Given a target string `str` and a `count` equal to 0,
9+ // When the repeatStr function is called with these inputs,
10+ // Then it should return an empty string.
11+
12+ test ( "should return empty string on count of 0" , ( ) => {
13+ const str = "hello" ;
14+ const count = 0 ;
15+ const repeatedStr = repeatStr ( str , count ) ;
16+ expect ( repeatedStr ) . toEqual ( "" ) ;
17+ } ) ;
18+
19+ // Case: Handle count of 0:
20+ // Given a target string `str` and a `count` equal to 0,
21+ // When the repeatStr function is called with these inputs,
22+ // Then it should return an empty string.
23+
24+ test ( "should return empty string on count of 0" , ( ) => {
25+ const str = "hello" ;
26+ const count = 0 ;
27+ const repeatedStr = repeatStr ( str , count ) ;
28+ expect ( repeatedStr ) . toEqual ( "" ) ;
29+ } ) ;
30+
731// Case: handle multiple repetitions:
832// Given a target string `str` and a positive integer `count` greater than 1,
933// When the repeatStr function is called with these inputs,
@@ -28,18 +52,6 @@ test("should return the original string when count is 1", () => {
2852 expect ( repeatedStr ) . toEqual ( "hello" ) ;
2953} ) ;
3054
31- // Case: Handle count of 0:
32- // Given a target string `str` and a `count` equal to 0,
33- // When the repeatStr function is called with these inputs,
34- // Then it should return an empty string.
35-
36- test ( "should return empty string on count of 0" , ( ) => {
37- const str = "hello" ;
38- const count = 0 ;
39- const repeatedStr = repeatStr ( str , count ) ;
40- expect ( repeatedStr ) . toEqual ( "" ) ;
41- } ) ;
42-
4355// Case: Handle negative count:
4456// Given a target string `str` and a negative integer `count`,
4557// When the repeatStr function is called with these inputs,
0 commit comments