Skip to content

Commit 9733fa3

Browse files
author
Ogbemi mene
committed
count.test answer
1 parent 0dc502d commit 9733fa3

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Sprint-3/2-practice-tdd/count.test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,13 @@ test("should count multiple occurrences of a character", () => {
2222
// And a character `char` that does not exist within `str`.
2323
// When the function is called with these inputs,
2424
// Then it should return 0, indicating that no occurrences of `char` were found.
25+
26+
// to solve this issue, we will implement a test case that checks for the scenario where the character is not found in the string.
27+
// The test will call the countChar function with a string and a character that does not exist in that string, and it will assert that the returned count is 0.
28+
// here is the code for the test case:
29+
test("should return 0 when character is not found", () => {
30+
const str = "hello";
31+
const char = "x";
32+
const count = countChar(str, char);
33+
expect(count).toEqual(0);
34+
});

0 commit comments

Comments
 (0)