@@ -8,34 +8,31 @@ 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 'st' to numbers ending in 1, except those ending in 11 " , ( ) => {
1212 expect ( getOrdinalNumber ( 1 ) ) . toEqual ( "1st" ) ;
13+ expect ( getOrdinalNumber ( 101 ) ) . toEqual ( "101st" ) ;
1314} ) ;
1415
15- //identify ordinal for 2
16- test ( "should return '2nd' for 2 " , ( ) => {
16+ //identify ordinal for nd
17+ test ( "append 'nd' to numbers ending in 2, except those ending in 12 " , ( ) => {
1718 expect ( getOrdinalNumber ( 2 ) ) . toEqual ( "2nd" ) ;
19+ expect ( getOrdinalNumber ( 132 ) ) . toEqual ( "132nd" ) ;
1820} ) ;
1921
20- //identify ordinal for 3
21- test ( "should return '3rd' for 3 " , ( ) => {
22+ //identify ordinal for rd
23+ test ( "append 'rd' to numbers ending in 3, except those ending in 13 " , ( ) => {
2224 expect ( getOrdinalNumber ( 3 ) ) . toEqual ( "3rd" ) ;
23- } ) ;
24-
25- //identify ordinal for 4
26- test ( "should return '4th' for 4" , ( ) => {
27- expect ( getOrdinalNumber ( 4 ) ) . toEqual ( "4th" ) ;
25+ expect ( getOrdinalNumber ( 23 ) ) . toEqual ( "23rd" ) ;
2826} ) ;
2927
3028//Special English Rule... 12, 13, 14 ending in "th"
31- test ( "should return '11th' for 11 " , ( ) => {
29+ test ( "append 'th' to numbers that end in 11, 12, or 13 " , ( ) => {
3230 expect ( getOrdinalNumber ( 11 ) ) . toEqual ( "11th" ) ;
31+ expect ( getOrdinalNumber ( 113 ) ) . toEqual ( "113th" ) ;
3332} ) ;
3433
35- test ( "should return '12th' for 12" , ( ) => {
36- expect ( getOrdinalNumber ( 12 ) ) . toEqual ( "12th" ) ;
37- } ) ;
38-
39- test ( "should return '13th' for 13" , ( ) => {
40- expect ( getOrdinalNumber ( 13 ) ) . toEqual ( "13th" ) ;
34+ //All other numbers => th
35+ test ( "append 'th' to all other numbers" , ( ) => {
36+ expect ( getOrdinalNumber ( 4 ) ) . toEqual ( "4th" ) ;
37+ expect ( getOrdinalNumber ( 100 ) ) . toEqual ( "100th" ) ;
4138} ) ;
0 commit comments