Skip to content

Commit dcaeeb5

Browse files
committed
refactored test and added second test for multiple occurrences of a character in a mixed string
1 parent f40ba8d commit dcaeeb5

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎practice-tdd/count.test.js‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,20 @@ import { countChar } from "./count.js";
1010
// When the function is called with these inputs,
1111
// Then it should correctly count occurrences of `char`.
1212

13-
test("should count multiple occurrences of a character", () => {
13+
test("should count a character when every character in the string matches", () => {
1414
const str = "aaaaa";
1515
const char = "a";
1616
const count = countChar(str, char);
1717
expect(count).toEqual(5);
1818
});
1919

20+
test("should count multiple occurrences of a character in a mixed string", () => {
21+
const str = "occurrence";
22+
const char = "c";
23+
const count = countChar(str, char);
24+
expect(count).toEqual(3);
25+
});
26+
2027
// Scenario: No Occurrences
2128
// Given the input string `str`,
2229
// And a character `char` that does not exist within `str`.

0 commit comments

Comments
 (0)