Skip to content

Commit b00a6cb

Browse files
committed
test: add cases for non-alphabet characters in countChar function
1 parent b548ddb commit b00a6cb

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,13 @@ test("Should return 0 for empty string", () => {
4141
// case 4
4242
test("should be case sensitive", () => {
4343
expect(countChar("aA", "a")).toEqual(1);
44-
});
44+
});
45+
46+
//case 5 Non-alphabet characters
47+
test(`Should work with numbers and symbols`, () => {
48+
expect(countChar("123451234123!&", "1")).toEqual(3);
49+
expect(countChar("@1hello@", "@")).toEqual(2);
50+
expect(countChar("white space ", " ")).toEqual(2);
51+
expect(countChar("-2534!-1322!", "!")).toEqual(2);
52+
expect(countChar("-hello ", "-")).toEqual(1);
53+
})

0 commit comments

Comments
 (0)