@@ -22,32 +22,32 @@ test("should count multiple occurrences of a character", () => {
2222// And a character char that does not exist within the case-sensitive str,
2323// When the function is called with these inputs,
2424// Then it should return 0, indicating that no occurrences of the char were found in the case-sensitive str.
25- test ( "should return 0 occurrences of b characters " , ( ) => {
25+ test ( "should return 0 when the character does not exist in the string " , ( ) => {
2626 const str = "Ahmad Hmedan" ;
2727 const char = "b" ;
2828 const count = countChar ( str , char ) ;
2929 expect ( count ) . toEqual ( 0 ) ;
3030} ) ;
3131
32- test ( "should return 1 occurrence of A characters" , ( ) => {
32+ test ( "should count a single occurrence when the character appears once" , ( ) => {
3333 const str = "Ahmad Hmedan" ;
3434 const char = "A" ;
3535 const count = countChar ( str , char ) ;
3636 expect ( count ) . toEqual ( 1 ) ;
3737} ) ;
38- test ( "should return 2 occurrence of m characters " , ( ) => {
38+ test ( "should count multiple occurrences when the character appears more than once " , ( ) => {
3939 const str = "Ahmad Hmedan" ;
4040 const char = "m" ;
4141 const count = countChar ( str , char ) ;
4242 expect ( count ) . toEqual ( 2 ) ;
4343} ) ;
44- test ( "should return occurrence of any characters in empty string " , ( ) => {
44+ test ( "should return 0 when the string is empty" , ( ) => {
4545 const str = "" ;
4646 const char = "@" ;
4747 const count = countChar ( str , char ) ;
4848 expect ( count ) . toEqual ( 0 ) ;
4949} ) ;
50- test ( "should return 1 occurrence of @ characters in empty string " , ( ) => {
50+ test ( "should correctly count special characters" , ( ) => {
5151 const str = "Ahmadhm@gamil.com" ;
5252 const char = "@" ;
5353 const count = countChar ( str , char ) ;
0 commit comments