@@ -9,24 +9,25 @@ const repeat = require("./repeat");
99// When the repeat function is called with these inputs,
1010// Then it should repeat the str count times and return a new string containing the repeated str values.
1111
12- test ( "should repeat the string count times" , ( ) => {
13- const str = "hello" ;
14- const count = 3 ;
15- const repeatedStr = repeat ( str , count ) ;
16- expect ( repeatedStr ) . toEqual ( "hellohellohello" ) ;
17- } ) ;
12+ // test("should repeat the string count times", () => {
13+ // const str = "hello";
14+ // const count = 3;
15+ // const repeatedStr = repeat(str, count);
16+ // expect(repeatedStr).toEqual("hellohellohello");
17+ // });
1818
1919// case: handle Count of 1:
2020// Given a target string str and a count equal to 1,
2121// When the repeat function is called with these inputs,
2222// Then it should return the original str without repetition, ensuring that a count of 1 results in no repetition.
23-
23+ console . log ( repeat ( "str" , 1 ) ) ; // Expected: "str"
2424// case: Handle Count of 0:
2525// Given a target string str and a count equal to 0,
2626// When the repeat function is called with these inputs,
2727// Then it should return an empty string, ensuring that a count of 0 results in an empty output.
28-
28+ console . log ( repeat ( "hello" , 0 ) ) ; // Expected: " "
2929// case: Negative Count:
3030// Given a target string str and a negative integer count,
3131// When the repeat function is called with these inputs,
3232// Then it should throw an error or return an appropriate error message, as negative counts are not valid.
33+ console . log ( repeat ( "hello" , - 3 ) ) ; // Expected: "Error: Count must be a non-negative integer"
0 commit comments