File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -11,14 +11,26 @@ const countChar = require("./count");
1111// Then it should correctly count overlapping occurrences of char (e.g., 'a' appears five times in 'aaaaa').
1212
1313test ( "should count multiple occurrences of a character" , ( ) => {
14- const str = "aaaaa " ;
15- const char = "a " ;
14+ const str = "shreef redwan hamed " ;
15+ const char = "e " ;
1616 const count = countChar ( str , char ) ;
17- expect ( count ) . toEqual ( 5 ) ;
17+ expect ( count ) . toEqual ( 4 ) ;
1818} ) ;
1919
2020// Scenario: No Occurrences
2121// Given the input string str,
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 ( "no char should return 0" , ( ) => {
26+ const str = "redwan" ;
27+ const char = "b" ;
28+ const count = countChar ( str , char ) ;
29+ expect ( count ) . toEqual ( 0 ) ;
30+ } ) ;
31+ test ( "no char should return 0" , ( ) => {
32+ const str = "cyf" ;
33+ const char = "k" ;
34+ const count = countChar ( str , char ) ;
35+ expect ( count ) . toEqual ( 0 ) ;
36+ } ) ;
You can’t perform that action at this time.
0 commit comments