@@ -8,21 +8,30 @@ 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" , ( ) => {
12- expect ( getOrdinalNumber ( 1 ) ) . toEqual ( "1st" ) ;
11+ test ( "append 'st' to numbers ending in 1, except those ending in 11" , ( ) => {
12+ 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} ) ;
1822
19- test ( "should return '3rd' for 3" , ( ) => {
20- expect ( getOrdinalNumber ( 3 ) ) . toEqual ( "3rd" ) ;
23+ test ( "append 'rd' to numbers ending in 3, except those ending in 13" , ( ) => {
24+ expect ( getOrdinalNumber ( 3 ) ) . toEqual ( "3rd" ) ;
25+ expect ( getOrdinalNumber ( 23 ) ) . toEqual ( "23rd" ) ;
26+ expect ( getOrdinalNumber ( 133 ) ) . toEqual ( "133rd" ) ;
2127} ) ;
2228
23- test ( "should return '4th' for 4" , ( ) => {
24- expect ( getOrdinalNumber ( 4 ) ) . toEqual ( "4th" ) ;
29+ test ( "append 'th' to numbers ending in 4 and more" , ( ) => {
30+ expect ( getOrdinalNumber ( 4 ) ) . toEqual ( "4th" ) ;
31+ expect ( getOrdinalNumber ( 25 ) ) . toEqual ( "25th" ) ;
32+ expect ( getOrdinalNumber ( 139 ) ) . toEqual ( "139th" ) ;
2533} ) ;
34+
2635test ( "should return '11th' for 11" , ( ) => {
2736 expect ( getOrdinalNumber ( 11 ) ) . toEqual ( "11th" ) ;
2837} ) ;
@@ -34,8 +43,4 @@ test("should return '12th' for 12", () => {
3443test ( "should return '13th' for 13" , ( ) => {
3544 expect ( getOrdinalNumber ( 13 ) ) . toEqual ( "13th" ) ;
3645} ) ;
37- test ( "append 'nd' to numbers ending in 2, except those ending in 12" , ( ) => {
38- expect ( getOrdinalNumber ( 2 ) ) . toEqual ( "2nd" ) ;
39- expect ( getOrdinalNumber ( 22 ) ) . toEqual ( "22nd" ) ;
40- expect ( getOrdinalNumber ( 132 ) ) . toEqual ( "132nd" ) ;
41- } ) ;
46+
0 commit comments