Skip to content

Commit 2c0fb31

Browse files
committed
add tests for ordinal suffixes for numbers ending with 1, 2 and 3
1 parent b63687d commit 2c0fb31

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎practice-tdd/get-ordinal-number.test.js‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,15 @@ 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+
test("should append 'nd' for numbers ending with 2, except those ending with 12", () => {
23+
expect(getOrdinalNumber(2)).toEqual("2nd");
24+
expect(getOrdinalNumber(22)).toEqual("22nd");
25+
expect(getOrdinalNumber(132)).toEqual("132nd");
26+
});
27+
28+
test("should append 'rd' for numbers ending with 3, except those ending with 13", () => {
29+
expect(getOrdinalNumber(3)).toEqual("3rd");
30+
expect(getOrdinalNumber(33)).toEqual("33rd");
31+
expect(getOrdinalNumber(143)).toEqual("143rd");
32+
});

0 commit comments

Comments
 (0)