Skip to content

Commit e749f57

Browse files
committed
update the tests for all valid integers.
1 parent 63d4861 commit e749f57

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

Sprint-3/3-mandatory-practice/implement/get-ordinal-number.test.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,26 @@ const getOrdinalNumber = require("./get-ordinal-number");
88
// When the number is 1,
99
// Then the function should return "1st"
1010

11-
//test("should return '1st' for 1", () => {
12-
//expect(getOrdinalNumber(1)).toEqual("1st");
13-
//});
14-
1511
test("append 'st' to numbers ending in 1, except those ending in 11", () => {
1612
expect(getOrdinalNumber(1)).toEqual("1st");
1713
expect(getOrdinalNumber(21)).toEqual("21st");
1814
expect(getOrdinalNumber(121)).toEqual("121st");
1915
});
16+
17+
test("appends 'nd' to numbers ending in 2, except those ending in 12", () => {
18+
expect(getOrdinalNumber(2)).toEqual("2nd");
19+
expect(getOrdinalNumber(22)).toEqual("22nd");
20+
expect(getOrdinalNumber(112)).toEqual("112th"); // special case
21+
});
22+
23+
test("appends 'rd' to numbers ending in 3, except those ending in 13", () => {
24+
expect(getOrdinalNumber(3)).toEqual("3rd");
25+
expect(getOrdinalNumber(23)).toEqual("23rd");
26+
expect(getOrdinalNumber(113)).toEqual("113th"); // special case
27+
});
28+
29+
test("appends 'th' to numbers ending in 11, 12, or 13", () => {
30+
expect(getOrdinalNumber(11)).toEqual("11th");
31+
expect(getOrdinalNumber(12)).toEqual("12th");
32+
expect(getOrdinalNumber(13)).toEqual("13th");
33+
});

0 commit comments

Comments
 (0)