@@ -8,19 +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 " , ( ) => {
11+ test ( "append 'nd' to numbers ending in 1, except those ending in 11 " , ( ) => {
1212 expect ( getOrdinalNumber ( 1 ) ) . toEqual ( "1st" ) ;
13+ expect ( getOrdinalNumber ( 21 ) ) . toEqual ( "21st" ) ;
14+ expect ( getOrdinalNumber ( 131 ) ) . toEqual ( "131st" ) ;
1315} ) ;
1416
15- test ( "should return '2nd' for 2" , ( ) => {
16- expect ( getOrdinalNumber ( 2 ) ) . toEqual ( "2nd" ) ;
17+ test ( "append '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 ( 132 ) ) . toEqual ( "132nd" ) ;
1721} ) ;
18-
19- test ( "should return '3rd' for 3" , ( ) => {
22+ test ( "append 'rd' to numbers ending in 3, except those ending in 13" , ( ) => {
2023 expect ( getOrdinalNumber ( 3 ) ) . toEqual ( "3rd" ) ;
24+ expect ( getOrdinalNumber ( 33 ) ) . toEqual ( "33rd" ) ;
25+ expect ( getOrdinalNumber ( 133 ) ) . toEqual ( "133rd" ) ;
2126} ) ;
22- test ( "should return '24th' for 24" , ( ) => {
23- expect ( getOrdinalNumber ( 24 ) ) . toEqual ( "24th" ) ;
27+ test ( "append 'th' to numbers ending in 4, except those ending in 14" , ( ) => {
28+ expect ( getOrdinalNumber ( 4 ) ) . toEqual ( "4th" ) ;
29+ expect ( getOrdinalNumber ( 24 ) ) . toEqual ( "24th" ) ;
30+ expect ( getOrdinalNumber ( 134 ) ) . toEqual ( "134th" ) ;
2431} ) ;
2532test ( "should return '11th' for 11" , ( ) => {
2633 expect ( getOrdinalNumber ( 11 ) ) . toEqual ( "11th" ) ;
0 commit comments