Skip to content

Commit ef697bb

Browse files
committed
sprint-3 exercies completed
1 parent f438971 commit ef697bb

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

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

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff 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

1313
test("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+
});

0 commit comments

Comments
 (0)