Skip to content

Commit 4b42c9f

Browse files
committed
Added some tests, additional test and passed the tests.
1 parent eb7c0eb commit 4b42c9f

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

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

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,29 @@ test("should return 0 when the input string is empty", () => {
4747
test("should count special characters like spaces or punctuation", () => {
4848
const str1 = "a b a b";
4949
const char1 = " ";
50-
expect(countChar(str1, char1)).toEqual(2);
50+
expect(countChar(str1, char1)).toEqual(3);
5151

5252
const str2 = "NO !!!";
5353
const char2 = "!";
5454
expect(countChar(str2, char2)).toEqual(3);
5555
});
5656

57+
// Scenario: Numeric characters inside string
58+
59+
test("should count numeric characters inside the string", () => {
60+
const str3 = "123321";
61+
const char3 = "2";
62+
expect(countChar(str3, char3)).toEqual(2);
63+
});
64+
65+
// Scenarion Accented characters
66+
67+
test("should count accented characters and unicode properly", () => {
68+
const str4 = "café";
69+
const char4 = "é";
70+
expect(countChar(str4, char4)).toEqual(1);
71+
});
72+
5773
// Scenario: Invalid inputs
5874

5975
test("should throw error for invalid string input", () => {
@@ -65,4 +81,6 @@ test("should throw error for invalid character input", () => {
6581
});
6682

6783

68-
// Added different cases and test using npx jest
84+
// Added different cases and test using npx jest
85+
86+
// Added some tests, additional test and passed the tests.

0 commit comments

Comments
 (0)