File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,7 +18,26 @@ test("should count multiple occurrences of a character", () => {
1818} ) ;
1919
2020// Scenario: No Occurrences
21+ test ( "should return 0 when the character does not occur in the string" , ( ) => {
22+ // Given the input string `str`
23+ const str = "hello" ;
24+ const char = "z" ;
25+ const count = countChar ( str , char ) ;
26+ expect ( count ) . toEqual ( 0 ) ;
27+ } ) ;
28+
29+ // // And a character `char` that does not exist in the string
30+ // const char = "z";
31+
32+ // // When the function is called with these inputs
33+ // const count = countChar(str, char);
34+
35+ // // Then it should return 0
36+ // expect(count).toEqual(0);
37+ // });
38+
2139// Given the input string `str`,
40+
2241// And a character `char` that does not exist within `str`.
2342// When the function is called with these inputs,
2443// Then it should return 0, indicating that no occurrences of `char` were found.
You can’t perform that action at this time.
0 commit comments