Skip to content

Commit a9da172

Browse files
committed
Made changes in the TDD Test as per review
1 parent 208f354 commit a9da172

File tree

2 files changed

+32
-19
lines changed

2 files changed

+32
-19
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,15 @@ test("should return 0 when the character is not found", () => {
2828
const count = countChar(str, char);
2929
expect(count).toEqual(0);
3030
});
31+
test("should return 0 when the character is case sensitive", () => {
32+
const str = "Hello";
33+
const char = "h";
34+
const count = countChar(str, char);
35+
expect(count).toEqual(0);
36+
});
37+
test("should count multiple occurrences of a symbols", () => {
38+
const str = "Brilliant!!!";
39+
const char = "!";
40+
const count = countChar(str, char);
41+
expect(count).toEqual(3);
42+
});

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

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,31 @@ test("should append 'st' for numbers ending with 1, except those ending with 11"
2222
// Case 2: Numbers ending with 2 (but not 12)
2323
// When the number ends with 2, except for those ending with 12,
2424
// Then the function should return a string by appending "nd" to the number.
25-
test("returns 'nd' for 2, 22, 102", () => {
26-
expect(getOrdinalNumber(2)).toBe("2nd");
27-
expect(getOrdinalNumber(22)).toBe("22nd");
28-
expect(getOrdinalNumber(102)).toBe("102nd");
29-
});
25+
test("appends 'nd' for numbers ending with 2, except those ending with 12", () => {
26+
expect(getOrdinalNumber(2)).toBe("2nd");
27+
expect(getOrdinalNumber(22)).toBe("22nd");
28+
expect(getOrdinalNumber(102)).toBe("102nd");
29+
});
3030

3131
// Case 3: Numbers ending with 3 (but not 13)
3232
// When the number ends with 3, except for those ending with 13,
3333
// Then the function should return a string by appending "rd" to the number.
34-
test("returns 'rd' for 3, 23, 103", () => {
35-
expect(getOrdinalNumber(3)).toBe("3rd");
36-
expect(getOrdinalNumber(23)).toBe("23rd");
37-
expect(getOrdinalNumber(103)).toBe("103rd");
38-
});
34+
test("appends 'rd' for numbers ending in 3, except those ending in 13", () => {
35+
expect(getOrdinalNumber(3)).toBe("3rd");
36+
expect(getOrdinalNumber(23)).toBe("23rd");
37+
expect(getOrdinalNumber(103)).toBe("103rd");
38+
});
3939

4040
// Case 4: All other numbers including umbers ending with 11, 12 or 13
4141
// These are for all other numbers including special cases and should always end with "th",
4242
// Then the function should return a string by appending "th" to the number.
43-
test("returns 'th' for all other numbers including those ending with 11, 12, 13", () => {
44-
expect(getOrdinalNumber(11)).toBe("11th");
45-
expect(getOrdinalNumber(12)).toBe("12th");
46-
expect(getOrdinalNumber(13)).toBe("13th");
47-
expect(getOrdinalNumber(10)).toBe("10th");
48-
expect(getOrdinalNumber(99)).toBe("99th");
49-
expect(getOrdinalNumber(100)).toBe("100th");
50-
51-
});
43+
test("returns 'th' for all numbers ending with 4-9 or 0 including numbers ending with 11, 12 and 13", () => {
44+
expect(getOrdinalNumber(11)).toBe("11th");
45+
expect(getOrdinalNumber(12)).toBe("12th");
46+
expect(getOrdinalNumber(13)).toBe("13th");
47+
expect(getOrdinalNumber(10)).toBe("10th");
48+
expect(getOrdinalNumber(5)).toBe("5th");
49+
expect(getOrdinalNumber(8)).toBe("8th");
50+
expect(getOrdinalNumber(99)).toBe("99th");
51+
expect(getOrdinalNumber(100)).toBe("100th");
52+
});

0 commit comments

Comments
 (0)