@@ -16,5 +16,33 @@ const getOrdinalNumber = require("./get-ordinal-number");
1616test ( "should append 'st' for numbers ending with 1, except those ending with 11" , ( ) => {
1717 expect ( getOrdinalNumber ( 1 ) ) . toEqual ( "1st" ) ;
1818 expect ( getOrdinalNumber ( 21 ) ) . toEqual ( "21st" ) ;
19- expect ( getOrdinalNumber ( 131 ) ) . toEqual ( "131st" ) ;
20- } ) ;
19+ expect ( getOrdinalNumber ( 41 ) ) . toEqual ( "41st" ) ;
20+ } ) ;
21+
22+ // Case 2: Numbers ending with 2 (but not 12)
23+ test ( "should append 'nd' for number ending with 2 except those ending with 12" , ( ) => {
24+ expect ( getOrdinalNumber ( 2 ) ) . toEqual ( "2nd" ) ;
25+ expect ( getOrdinalNumber ( 22 ) ) . toEqual ( "22nd" ) ;
26+ expect ( getOrdinalNumber ( 42 ) ) . toEqual ( "42nd" ) ;
27+ } ) ;
28+
29+ // Case 3: Numbers ending with 3 (but not 13)
30+ test ( "should append 'rd' for number anding with 3 expect those ending with 13" , ( ) => {
31+ expect ( getOrdinalNumber ( 3 ) ) . toEqual ( "3rd" ) ;
32+ expect ( getOrdinalNumber ( 33 ) ) . toEqual ( "33rd" ) ;
33+ expect ( getOrdinalNumber ( 43 ) ) . toEqual ( "43rd" ) ;
34+ } ) ;
35+
36+ // Case 4: Number ending with 4 (but not 14)
37+ test ( "should append 'th' for number ending with 4 expcet those ending with 14" , ( ) => {
38+ expect ( getOrdinalNumber ( 4 ) ) . toEqual ( "4th" ) ;
39+ expect ( getOrdinalNumber ( 44 ) ) . toEqual ( "44th" ) ;
40+ expect ( getOrdinalNumber ( 54 ) ) . toEqual ( "54th" ) ;
41+ } ) ;
42+
43+ // Case 5: Number ending with 5 (but not 15)
44+ test ( "should append 'th' for number ending with 5 except those ending with 15" , ( ) => {
45+ expect ( getOrdinalNumber ( 5 ) ) . toEqual ( "5th" ) ;
46+ expect ( getOrdinalNumber ( 55 ) ) . toEqual ( "55th" ) ;
47+ expect ( getOrdinalNumber ( 65 ) ) . toEqual ( "65th" ) ;
48+ } ) ;
0 commit comments