@@ -19,14 +19,53 @@ test("should append 'st' for numbers ending with 1, except those ending with 11"
1919 expect ( getOrdinalNumber ( 131 ) ) . toEqual ( "131st" ) ;
2020} ) ;
2121
22+ < << << << Updated upstream
2223test ( "should append 'nd' for numbers ending with 2" , ( ) => {
24+ === === =
25+ // Case 2: Numbers ending with 2 (but not 12)
26+ // When the number ends with 2, except those ending with 12,
27+ // Then the function should return a string by appending "nd" to the number
28+ test ( "Numbers ending with 2 (but not 12) should return 'nd'" , ( ) => {
29+ >>> >>> > Stashed changes
2330 expect ( getOrdinalNumber ( 2 ) ) . toEqual ( "2nd" ) ;
2431 expect ( getOrdinalNumber ( 22 ) ) . toEqual ( "22nd" ) ;
2532 expect ( getOrdinalNumber ( 132 ) ) . toEqual ( "132nd" ) ;
2633} ) ;
2734
35+ < << << << Updated upstream
2836test ( "should append 'rd' for numbers ending with 3, except those ending with 13" , ( ) => {
2937 expect ( getOrdinalNumber ( 3 ) ) . toEqual ( "3rd" ) ;
3038 expect ( getOrdinalNumber ( 33 ) ) . toEqual ( "33rd" ) ;
3139 expect ( getOrdinalNumber ( 133 ) ) . toEqual ( "133rd" ) ;
3240} ) ;
41+ = === ===
42+ // Case 3: Numbers ending with 3 (but not 13)
43+ // When the number ends with 3, except those ending with 13,
44+ // Then the function should return a string by appending "rd" to the number
45+ test ( "Numbers ending with 3 (but not 13) should return 'rd'" , ( ) => {
46+ expect ( getOrdinalNumber ( 3 ) ) . toEqual ( "3rd" ) ;
47+ expect ( getOrdinalNumber ( 23 ) ) . toEqual ( "23rd" ) ;
48+ expect ( getOrdinalNumber ( 133 ) ) . toEqual ( "133rd" ) ;
49+ } ) ;
50+
51+ // Case 4: Numbers ending with 0,4-9
52+ // When the number ends with 0, 4, 5, 6, 7, 8, or 9,
53+ // Then the function should return a string by appending "th" to the number
54+ test ( "Numbers ending with 0,4-9 should return 'th'" , ( ) => {
55+ expect ( getOrdinalNumber ( 4 ) ) . toEqual ( "4th" ) ;
56+ expect ( getOrdinalNumber ( 10 ) ) . toEqual ( "10th" ) ;
57+ expect ( getOrdinalNumber ( 25 ) ) . toEqual ( "25th" ) ;
58+ } ) ;
59+
60+ // Case 5: Numbers ending with 11, 12, or 13
61+ // When the number ends with 11, 12, or 13,
62+ // Then the function should return a string by appending "th" to the number
63+ test ( "Numbers ending with 11,12,13 should return 'th'" , ( ) => {
64+ expect ( getOrdinalNumber ( 11 ) ) . toEqual ( "11th" ) ;
65+ expect ( getOrdinalNumber ( 12 ) ) . toEqual ( "12th" ) ;
66+ expect ( getOrdinalNumber ( 13 ) ) . toEqual ( "13th" ) ;
67+ expect ( getOrdinalNumber ( 111 ) ) . toEqual ( "111th" ) ;
68+ expect ( getOrdinalNumber ( 112 ) ) . toEqual ( "112th" ) ;
69+ expect ( getOrdinalNumber ( 113 ) ) . toEqual ( "113th" ) ;
70+ } ) ;
71+ > >>> >>> Stashed changes
0 commit comments