@@ -24,53 +24,13 @@ test("should count multiple occurrences of a character", () => {
2424// Then it should return 0, indicating that no occurrences of `char` were found.
2525
2626test ( "should count multiple occurrences of a character" , ( ) => {
27- const str = "aaaaa" ;
28- const char = "a" ;
29- const count = countChar ( str , char ) ;
30- expect ( count ) . toEqual ( 5 ) ;
31- } ) ;
32-
33- test ( "should count multiple occurrences of a character" , ( ) => {
34- const str = "blind" ;
35- const char = "a" ;
36- const count = countChar ( str , char ) ;
37- expect ( count ) . toEqual ( 0 ) ;
38- } ) ;
39-
40- test ( "should count multiple occurrences of a character" , ( ) => {
41- const str = "blood" ;
42- const char = "o" ;
43- const count = countChar ( str , char ) ;
44- expect ( count ) . toEqual ( 2 ) ;
45- } ) ;
46-
47- test ( "should count multiple occurrences of a character" , ( ) => {
48- const str = "blood" ;
49- const char = "o" ;
50- const count = countChar ( str , char ) ;
51- expect ( count ) . toEqual ( 2 ) ;
52- } ) ;
53-
54- test ( "should count multiple occurrences of a character" , ( ) => {
55- const str = "blood" ;
56- const char = "l" ;
57- const count = countChar ( str , char ) ;
58- expect ( count ) . toEqual ( 1 ) ;
59- } ) ;
60-
61- test ( "should count multiple occurrences of a character" , ( ) => {
62- const str = "bbbrf" ;
63- const char = "b" ;
64- const count = countChar ( str , char ) ;
65- expect ( count ) . toEqual ( 3 ) ;
66- } ) ;
67-
68- test ( "should count multiple occurrences of a character" , ( ) => {
69- const str = "ooooa" ;
70- const char = "o" ;
71- const count = countChar ( str , char ) ;
72- expect ( count ) . toEqual ( 4 ) ;
73- } ) ;
27+ expect ( countChar ( "aaaaa" , 'b")).toEqual(5);
28+ expect ( countChar ( "blind" , 'a)).toEqual(0);
29+ expect ( countChar ( "blood" , 'o")).toEqual(2);
30+ expect ( countChar ( "bbbrf" , 'b")).toEqual(3);
31+ expect ( countChar ( "ooooa" , 'o")).toEqual(4);
32+ } ) ;
33+
7434
7535// handling invalid input
7636// the tests work assuming that only letters are in the string
0 commit comments