File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed
Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -17,8 +17,3 @@ function assertFunction(currentOutput,targetOutput)
1717 `expect ${ currentOutput } to equal ${ targetOutput } `
1818 ) ;
1919}
20- assertFunction ( countChar ( "Ahmaaa hmaaa" , 'a' ) , 6 ) ;
21- assertFunction ( countChar ( "Ahmaaa hmaaa" , 'm' ) , 2 ) ;
22- assertFunction ( countChar ( "Ahmaaa hmaaa" , 'b' ) , 0 ) ;
23- assertFunction ( countChar ( "Ahmaaa hmaaa" , 'A' ) , 1 ) ;
24- assertFunction ( countChar ( "" , 'A' ) , 0 ) ;
Original file line number Diff line number Diff line change @@ -40,4 +40,16 @@ test("should return 2 occurrence of m characters",()=>{
4040 const char = "m" ;
4141 const count = countChar ( str , char ) ;
4242 expect ( count ) . toEqual ( 2 ) ;
43- } )
43+ } )
44+ test ( "should return occurrence of any characters in empty string" , ( ) => {
45+ const str = "" ;
46+ const char = "@" ;
47+ const count = countChar ( str , char ) ;
48+ expect ( count ) . toEqual ( 0 ) ;
49+ } )
50+ test ( "should return 1 occurrence of @ characters in empty string" , ( ) => {
51+ const str = "Ahmadhm@gamil.com" ;
52+ const char = "@" ;
53+ const count = countChar ( str , char ) ;
54+ expect ( count ) . toEqual ( 1 ) ;
55+ } )
You can’t perform that action at this time.
0 commit comments