@@ -20,25 +20,25 @@ test("should append 'st' for numbers ending with 1, except those ending with 11"
2020} ) ;
2121
2222// Case 2: Numbers ending in 2 → add nd → (2nd, 22nd, 42nd)
23- test ( "should append 'st ' for numbers ending with 1, except those ending with 11 " , ( ) => {
23+ test ( "should append 'nd ' for numbers ending with 2 " , ( ) => {
2424 expect ( getOrdinalNumber ( 2 ) ) . toEqual ( "2nd" ) ;
2525 expect ( getOrdinalNumber ( 22 ) ) . toEqual ( "22nd" ) ;
2626 expect ( getOrdinalNumber ( 142 ) ) . toEqual ( "142nd" ) ;
2727} ) ;
2828// Case 3: Numbers ending in 3 → add rd → (3rd, 23rd, 53rd)
29- test ( "should append 'st ' for numbers ending with 1, except those ending with 11 " , ( ) => {
29+ test ( "should append '3rd ' for numbers ending with 3 " , ( ) => {
3030 expect ( getOrdinalNumber ( 3 ) ) . toEqual ( "3rd" ) ;
3131 expect ( getOrdinalNumber ( 33 ) ) . toEqual ( "33rd" ) ;
3232 expect ( getOrdinalNumber ( 153 ) ) . toEqual ( "153rd" ) ;
3333} ) ;
3434// Case 4: All other numbers → add th → (4th, 6th, 20th, 100th)
35- test ( "should append 'st ' for numbers ending with 1, except those ending with 11 " , ( ) => {
35+ test ( "should append 'th ' for numbers ending with 4 " , ( ) => {
3636 expect ( getOrdinalNumber ( 4 ) ) . toEqual ( "4th" ) ;
3737 expect ( getOrdinalNumber ( 20 ) ) . toEqual ( "20th" ) ;
3838 expect ( getOrdinalNumber ( 100 ) ) . toEqual ( "100th" ) ;
3939} ) ;
4040// Exceptions: Numbers ending in 11, 12, and 13 use -th (e.g., 11th, 12th, 13th).
41- test ( "should append 'st ' for numbers ending with 1, except those ending with 11 " , ( ) => {
41+ test ( "should append 'th ' for numbers ending with 11, 12 and 13 " , ( ) => {
4242 expect ( getOrdinalNumber ( 11 ) ) . toEqual ( "11th" ) ;
4343 expect ( getOrdinalNumber ( 12 ) ) . toEqual ( "12th" ) ;
4444 expect ( getOrdinalNumber ( 113 ) ) . toEqual ( "113th" ) ;
0 commit comments