Skip to content

Commit 8edf045

Browse files
committed
added jest cases to ensure the functions is works correctly
1 parent 9f01d08 commit 8edf045

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,31 @@ 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+
test("should count multiple occurrences of a character", () => {
27+
const str = "banana";
28+
const char = "n";
29+
const count = countChar(str, char);
30+
expect(count).toEqual(2);
31+
});
32+
33+
test("should count multiple occurrences of a character", () => {
34+
const str = "appleTree";
35+
const char = "e";
36+
const count = countChar(str, char);
37+
expect(count).toEqual(3);
38+
});
39+
40+
test("should count multiple occurrences of a character", () => {
41+
const str = "strawberry";
42+
const char = "r";
43+
const count = countChar(str, char);
44+
expect(count).toEqual(3);
45+
});
46+
47+
test("should count multiple occurrences of a character", () => {
48+
const str = "ghost";
49+
const char = "o";
50+
const count = countChar(str, char);
51+
expect(count).toEqual(1);
52+
});

0 commit comments

Comments
 (0)