Skip to content

Commit 3bb795f

Browse files
committed
Tests for non-alphabet characters and is case-sensitive
1 parent 8757e5a commit 3bb795f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,18 @@ test("should return 0 when both the input string and character are empty", () =>
4040
const count = countChar(str, char);
4141
expect(count).toEqual(0);
4242
});
43+
test("should be case sensitive when counting characters", () => {
44+
const str = "AaAaA";
45+
const char = "a";
46+
const count = countChar(str, char);
47+
expect(count).toEqual(2);
48+
});
49+
test("should count non-alphabet characters", () => {
50+
const str = "12345!";
51+
const char = "1";
52+
const count = countChar(str, char);
53+
expect(count).toEqual(1);
54+
});
4355
// Scenario: Empty String
4456
// Given an empty input string `str`,
4557
// And any character `char` (e.g., 'a'),

0 commit comments

Comments
 (0)