Skip to content

Commit 9a4ad71

Browse files
created new branch and add diffrent test cases
1 parent 3372770 commit 9a4ad71

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,25 @@ test("should append 'st' for numbers ending with 1, except those ending with 11"
1818
expect(getOrdinalNumber(21)).toEqual("21st");
1919
expect(getOrdinalNumber(131)).toEqual("131st");
2020
});
21+
22+
// Case 2: numbers ending with 2 (except 12)
23+
test("should append 'nd' for numbers ending with 2, except those ending with 12", () => {
24+
expect(getOrdinalNumber(2)).toEqual("2nd");
25+
expect(getOrdinalNumber(22)).toEqual("22nd");
26+
expect(getOrdinalNumber(142)).toEqual("142nd");
27+
});
28+
29+
// Case 3: numbers ending with 3 (except 13)
30+
test("should append 'rd' for numbers ending with 3, except those ending with 13", () => {
31+
expect(getOrdinalNumber(3)).toEqual("3rd");
32+
expect(getOrdinalNumber(23)).toEqual("23rd");
33+
expect(getOrdinalNumber(143)).toEqual("143rd");
34+
});
35+
36+
// Case 4: numbers ending with 0, 4-9 (except 10-19)
37+
test("should append 'th' for numbers ending with 0, 4-9, except those ending with 10-19", () => {
38+
expect(getOrdinalNumber(0)).toEqual("0th");
39+
expect(getOrdinalNumber(4)).toEqual("4th");
40+
expect(getOrdinalNumber(10)).toEqual("10th");
41+
expect(getOrdinalNumber(14)).toEqual("14th");
42+
});

0 commit comments

Comments
 (0)