Skip to content

Commit 9c2b470

Browse files
committed
Pass the count code test
1 parent 6ab27fc commit 9c2b470

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
const countChar = require("./count");
33
// Given a string str and a single character char to search for,
44
// When the countChar function is called with these inputs,
5-
// Then it should:
5+
// Then it should: Return how many time the char occurs in the str.
66

77
// Scenario: Multiple Occurrences
88
// Given the input string str,
@@ -22,3 +22,9 @@ 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 character does not exist in the string", () => {
26+
const str = "hello world";
27+
const char = "z";
28+
const count = countChar(str, char);
29+
expect(count).toEqual(0);
30+
});

0 commit comments

Comments
 (0)