@@ -37,15 +37,26 @@ test("should append 'rd' for numbers ending with 3, except those ending with 13"
3737 expect ( getOrdinalNumber ( 13453 ) ) . toEqual ( "13453rd" ) ;
3838} ) ;
3939
40- // Case 4: All other numbers
41- // When the number does not end with 1, 2 , or 3 (except for the exceptions) ,
40+ // Case 4: numbers ending with 11, 12, or 13
41+ // When the number ends with 11, 12 , or 13 ,
4242// Then the function should return a string by appending "th" to the number.
43- test ( "should append 'th' for all other numbers" , ( ) => {
44- expect ( getOrdinalNumber ( 4 ) ) . toEqual ( "4th" ) ;
45- expect ( getOrdinalNumber ( 10 ) ) . toEqual ( "10th" ) ;
43+
44+ test ( "should append 'th' for numbers ending with 11, 12, or 13" , ( ) => {
4645 expect ( getOrdinalNumber ( 11 ) ) . toEqual ( "11th" ) ;
4746 expect ( getOrdinalNumber ( 12 ) ) . toEqual ( "12th" ) ;
4847 expect ( getOrdinalNumber ( 13 ) ) . toEqual ( "13th" ) ;
48+ } ) ;
49+
50+ // Case 5: numbers that ends with 0, 4, 5, 6, 7, 8, or 9
51+ // When the number does not end with 1, 2, or 3
52+ // Then the function should return a string by appending "th" to the number.
53+
54+ test ( "should append 'th' for all other numbers" , ( ) => {
55+ expect ( getOrdinalNumber ( 4 ) ) . toEqual ( "4th" ) ;
56+ expect ( getOrdinalNumber ( 10 ) ) . toEqual ( "10th" ) ;
57+ expect ( getOrdinalNumber ( 11 ) ) . toEqual ( "115th" ) ;
58+ expect ( getOrdinalNumber ( 12 ) ) . toEqual ( "126th" ) ;
59+ expect ( getOrdinalNumber ( 13 ) ) . toEqual ( "137th" ) ;
4960 expect ( getOrdinalNumber ( 100 ) ) . toEqual ( "100th" ) ;
5061 expect ( getOrdinalNumber ( 1012 ) ) . toEqual ( "1012th" ) ;
5162 expect ( getOrdinalNumber ( 1038 ) ) . toEqual ( "1038th" ) ;
0 commit comments