@@ -8,18 +8,34 @@ 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 " , ( ) => {
11+ test ( "should append 'st' to numbers with 1 at the end except for those ending with 11 " , ( ) => {
1212 expect ( getOrdinalNumber ( 1 ) ) . toEqual ( "1st" ) ;
13+ expect ( getOrdinalNumber ( 21 ) ) . toEqual ( "21st" ) ;
14+ expect ( getOrdinalNumber ( 101 ) ) . toEqual ( "101st" ) ;
15+ expect ( getOrdinalNumber ( 151 ) ) . toEqual ( "151st" ) ;
16+ expect ( getOrdinalNumber ( 2061 ) ) . toEqual ( "2061st" ) ;
1317} ) ;
1418
15- test ( "should return '2nd' for 2 " , ( ) => {
19+ test ( "should append 'nd' to numbers with 2 at the end except for those ending with 12 " , ( ) => {
1620 expect ( getOrdinalNumber ( 2 ) ) . toEqual ( "2nd" ) ;
21+ expect ( getOrdinalNumber ( 22 ) ) . toEqual ( "22nd" ) ;
22+ expect ( getOrdinalNumber ( 342 ) ) . toEqual ( "342nd" ) ;
23+ expect ( getOrdinalNumber ( 592 ) ) . toEqual ( "592nd" ) ;
24+ expect ( getOrdinalNumber ( 1972 ) ) . toEqual ( "1972nd" ) ;
1725} ) ;
1826
19- test ( "should return '3rd' for 3 " , ( ) => {
27+ test ( "should append 'rd' to numbers with 3 at the end except for those ending with 13 " , ( ) => {
2028 expect ( getOrdinalNumber ( 3 ) ) . toEqual ( "3rd" ) ;
29+ expect ( getOrdinalNumber ( 33 ) ) . toEqual ( "33rd" ) ;
30+ expect ( getOrdinalNumber ( 353 ) ) . toEqual ( "353rd" ) ;
31+ expect ( getOrdinalNumber ( 93 ) ) . toEqual ( "93rd" ) ;
32+ expect ( getOrdinalNumber ( 783 ) ) . toEqual ( "783rd" ) ;
2133} ) ;
2234
23- test ( "should return any number between 4 and 20 with a suffix of 'th' at end of number " , ( ) => {
35+ test ( "should append 'th' to all other numbers which do not end in 1,2,3,11,12 or 13 " , ( ) => {
2436 expect ( getOrdinalNumber ( 10 ) ) . toEqual ( "10th" ) ;
37+ expect ( getOrdinalNumber ( 11 ) ) . toEqual ( "11th" ) ;
38+ expect ( getOrdinalNumber ( 212 ) ) . toEqual ( "212th" ) ;
39+ expect ( getOrdinalNumber ( 113 ) ) . toEqual ( "113th" ) ;
40+ expect ( getOrdinalNumber ( 17 ) ) . toEqual ( "17th" ) ;
2541} ) ;
0 commit comments