Skip to content

Commit 86311c7

Browse files
committed
Add a test case for multi-character input in countChar
Add a test to ensure countChar throws an error when more than one character is passed as the 'char' argument, returning a descriptive invalid input message.
1 parent 01cb978 commit 86311c7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,11 @@ test("should return 0 occurrence of character in an empty string", () => {
4949
expect(count).toEqual(0);
5050
});
5151

52+
test("should throw an error when more than one string is passed as char", () => {
53+
const str = "jump";
54+
const char = "pp";
55+
const count = countChar(str, char);
56+
expect(count).toEqual("invalid input: Input just one character");
57+
});
58+
59+

0 commit comments

Comments
 (0)