@@ -11,3 +11,67 @@ const getOrdinalNumber = require("./get-ordinal-number");
1111test ( "should return '1st' for 1" , ( ) => {
1212 expect ( getOrdinalNumber ( 1 ) ) . toEqual ( "1st" ) ;
1313} ) ;
14+
15+ // Case 2: Identify the ordinal number for 2
16+ // When the number is 2,
17+ // Then the function should return "2nd"
18+
19+ test ( "should return '2nd' for 2" , ( ) => {
20+ expect ( getOrdinalNumber ( 2 ) ) . toEqual ( "2nd" ) ;
21+ } ) ;
22+
23+ // Case 3: Identify the ordinal number for 3
24+ // When the number is 3,
25+ // Then the function should return "3rd"
26+
27+ test ( "should return '3rd' for 3" , ( ) => {
28+ expect ( getOrdinalNumber ( 3 ) ) . toEqual ( "3rd" ) ;
29+ } ) ;
30+
31+ // Case 4: Identify the ordinal number for 4
32+ // When the number is 4,
33+ // Then the function should return "4th"
34+
35+ test ( "should return '4th' for 4" , ( ) => {
36+ expect ( getOrdinalNumber ( 4 ) ) . toEqual ( "4th" ) ;
37+ } ) ;
38+
39+ // Case 5: Identify the ordinal number for 11
40+ // When the number is 11,
41+ // Then the function should return "11th"
42+
43+ test ( "should return '11th' for 11" , ( ) => {
44+ expect ( getOrdinalNumber ( 11 ) ) . toEqual ( "11th" ) ;
45+ } ) ;
46+
47+ // Case 6: Identify the ordinal number for 21
48+ // When the number is 21,
49+ // Then the function should return "21st"
50+
51+ test ( "should return '21st' for 21" , ( ) => {
52+ expect ( getOrdinalNumber ( 21 ) ) . toEqual ( "21st" ) ;
53+ } ) ;
54+
55+ // Case 7: Identify the ordinal number for 102
56+ // When the number is 102,
57+ // Then the function should return "102nd"
58+
59+ test ( "should return '102nd' for 102" , ( ) => {
60+ expect ( getOrdinalNumber ( 102 ) ) . toEqual ( "102nd" ) ;
61+ } ) ;
62+
63+ // Case 8: Identify the ordinal number for 111
64+ // When the number is 111,
65+ // Then the function should return "111th"
66+
67+ test ( "should return '111th' for 111" , ( ) => {
68+ expect ( getOrdinalNumber ( 111 ) ) . toEqual ( "111th" ) ;
69+ } ) ;
70+
71+ // case 9: identify the ordinal number for 211
72+ // when the number is 211
73+ // then the function should return "211th"
74+
75+ test ( "should return '33rd' for 33" , ( ) => {
76+ expect ( getOrdinalNumber ( 33 ) ) . toEqual ( "33rd" ) ;
77+ } ) ;
0 commit comments