Skip to content

Commit 9392648

Browse files
refactor: update test descriptions and add edge cases based on CJ review
1 parent 163ef9e commit 9392648

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,17 @@ test("should count multiple occurrences of a character", () => {
2222
// And a character `char` that does not exist within `str`.
2323
// When the function is called with these inputs,
2424
// Then it should return 0, indicating that no occurrences of `char` were found.
25+
26+
test("should return 0 when character does not exist in the string", () => {
27+
const str = "hello";
28+
const char = "z";
29+
const count = countChar(str, char);
30+
expect(count).toEqual(0);
31+
});
32+
33+
test("should return 0 when the string is completely empty", () => {
34+
const str = "";
35+
const char = "a";
36+
const count = countChar(str, char);
37+
expect(count).toEqual(0);
38+
});

Sprint-3/2-practice-tdd/get-ordinal-number.test.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,17 @@ test("should append 'rd' for numbers ending with 3", () => {
2424
});
2525

2626
// Case 4: The 'Teens' exceptions (11, 12, 13)
27-
test("should append 'th' for 11, 12, and 13", () => {
27+
test("should append 'th' for numbers ending with 11, 12, and 13", () => {
2828
expect(getOrdinalNumber(11)).toEqual("11th");
2929
expect(getOrdinalNumber(12)).toEqual("12th");
3030
expect(getOrdinalNumber(13)).toEqual("13th");
31+
expect(getOrdinalNumber(111)).toEqual("111th");
32+
expect(getOrdinalNumber(212)).toEqual("212th");
33+
expect(getOrdinalNumber(313)).toEqual("313th");
3134
});
3235

3336
// Case 5: General 'th' cases
34-
test("should append 'th' for other numbers", () => {
37+
test("should append 'th' for numbers ending in 0, 4, 5, 6, 7, 8, and 9", () => {
3538
expect(getOrdinalNumber(4)).toEqual("4th");
3639
expect(getOrdinalNumber(10)).toEqual("10th");
3740
});

0 commit comments

Comments
 (0)