Skip to content

Commit af66632

Browse files
committed
Update: add test case for countChar function to verify function
1 parent 1014714 commit af66632

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Sprint-3/3-mandatory-practice/implement/count.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,11 @@ 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 when the character is not present", () => {
26+
const str = "aaaaa";
27+
const char = "z"; // 'z' does not exist in "aaaaa"
28+
const count = countChar(str, char);
29+
expect(count).toEqual(0);
30+
});
31+
32+
module.exports = countChar;

0 commit comments

Comments
 (0)