@@ -19,7 +19,7 @@ test("should append 'st' for numbers ending with 1, except those ending with 11"
1919 expect ( getOrdinalNumber ( 131 ) ) . toEqual ( "131st" ) ;
2020} ) ;
2121
22- // Case 2: Numbers ending with 2
22+ // Case 2: Numbers ending with 2, except those ending with 12
2323// When the number ends with 2
2424// Then the function should return a string by appending "nd" to the number.
2525test ( "should append 'nd' for numbers ending with 2" , ( ) => {
@@ -28,7 +28,7 @@ test("should append 'nd' for numbers ending with 2", () => {
2828 expect ( getOrdinalNumber ( 132 ) ) . toEqual ( "132nd" ) ;
2929} ) ;
3030
31- // Case 3: Numbers ending with 3
31+ // Case 3: Numbers ending with 3, except those ending in 13
3232// When the number ends with 3
3333// Then the function should return a string by appending "rd" to the number.
3434test ( "should append 'rd' for numbers ending with 3" , ( ) => {
@@ -37,7 +37,7 @@ test("should append 'rd' for numbers ending with 3", () => {
3737 expect ( getOrdinalNumber ( 223 ) ) . toEqual ( "223rd" ) ;
3838} ) ;
3939
40- // Case 4: the general(ish) case
40+ // Case 4: the general case
4141// When numbers end with 0, 4, 5, 6, 7, 8, 9
4242// The function should return a string by appending "th" to the number
4343test ( "should append 'th' for numbers ending with 0, 4, 5, 6, 7, 8, 9" , ( ) => {
@@ -48,11 +48,20 @@ test("should append 'th' for numbers ending with 0, 4, 5, 6, 7, 8, 9", () => {
4848 expect ( getOrdinalNumber ( 57 ) ) . toEqual ( "57th" ) ;
4949 expect ( getOrdinalNumber ( 78 ) ) . toEqual ( "78th" ) ;
5050 expect ( getOrdinalNumber ( 89 ) ) . toEqual ( "89th" ) ;
51+ expect ( getOrdinalNumber ( 189 ) ) . toEqual ( "189th" ) ;
5152} ) ;
5253
53- // Case 5: The special case of 11
54- // When the number is 11
54+ // Case 5: The special cases when last two digits are 11, 12 13
55+ // When the last two digits are 11, 12, or 13
5556// Then the function should return a string by appending "th" to the number.
56- test ( "should append 'th' for 11 " , ( ) => {
57+ test ( "should append 'th' for number whose last two digits are 11, 12, 13 " , ( ) => {
5758 expect ( getOrdinalNumber ( 11 ) ) . toEqual ( "11th" ) ;
59+ expect ( getOrdinalNumber ( 12 ) ) . toEqual ( "12th" ) ;
60+ expect ( getOrdinalNumber ( 13 ) ) . toEqual ( "13th" ) ;
61+ expect ( getOrdinalNumber ( 111 ) ) . toEqual ( "111th" ) ;
62+ expect ( getOrdinalNumber ( 112 ) ) . toEqual ( "112th" ) ;
63+ expect ( getOrdinalNumber ( 113 ) ) . toEqual ( "113th" ) ;
64+ expect ( getOrdinalNumber ( 211 ) ) . toEqual ( "211th" ) ;
65+ expect ( getOrdinalNumber ( 212 ) ) . toEqual ( "212th" ) ;
66+ expect ( getOrdinalNumber ( 313 ) ) . toEqual ( "313th" ) ;
5867} ) ;
0 commit comments