@@ -21,7 +21,7 @@ test("should repeat the string count times", () => {
2121// When the repeatStr function is called with these inputs,
2222// Then it should return the original `str` without repetition.
2323
24- test ( "should repeat the string count times " , ( ) => {
24+ test ( "should repeat the string count 1 time " , ( ) => {
2525 const str = "hi" ;
2626 const count = 1 ;
2727 const repeatedStr = repeatStr ( str , count ) ;
@@ -33,8 +33,8 @@ test("should repeat the string count times", () => {
3333// When the repeatStr function is called with these inputs,
3434// Then it should return an empty string.
3535
36- test ( "should repeat the string count times " , ( ) => {
37- const str = "" ;
36+ test ( "should repeat the string 0 time " , ( ) => {
37+ const str = "hello " ;
3838 const count = 0 ;
3939 const repeatedStr = repeatStr ( str , count ) ;
4040 expect ( repeatedStr ) . toEqual ( "" ) ;
@@ -45,9 +45,8 @@ test("should repeat the string count times", () => {
4545// When the repeatStr function is called with these inputs,
4646// Then it should throw an error, as negative counts are not valid.
4747
48- test ( "should repeat the string count times " , ( ) => {
48+ test ( "should throw an error " , ( ) => {
4949 const str = "hello" ;
5050 const count = - 1 ;
51- const repeatedStr = repeatStr ( str , count ) ;
52- expect ( repeatedStr ) . toEqual ( "" ) ;
51+ expect ( ( ) => repeatedStr ( str , count ) ) . toThrow ( ) ;
5352} ) ;
0 commit comments