Skip to content

Commit 035ca52

Browse files
Adding a jest test for 0 or empty string
1 parent c7ddaed commit 035ca52

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ test("should count multiple occurrences of a character", () => {
1717
expect(count).toEqual(5);
1818
});
1919

20+
test("should return 0 when character does not occur in string", () => {
21+
const str = "hello";
22+
const char = "z";
23+
const count = countChar(str, char);
24+
expect(count).toEqual(0);
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)