@@ -281,48 +281,37 @@ describe('libs/NextStepUtils', () => {
281281 } ) ;
282282
283283 test ( 'monthly on the 2nd' , ( ) => {
284- // `buildOptimisticNextStep` treats an offset landing on today as due today, while
285- // `getNextNthOfMonth` always skips to next month, so the two only disagree when the suite runs on
286- // the 2nd itself. Freeze the clock on a day that is not the 2nd so this stays deterministic.
287- jest . useFakeTimers ( ) ;
288- jest . setSystemTime ( new Date ( 2026 , 0 , 15 ) ) ;
289-
290- try {
291- // Waiting for userSubmitter's expense(s) to automatically submit on the 2nd of each month
292- const expectedResult : ReportNextStep = {
293- messageKey : CONST . NEXT_STEP . MESSAGE_KEY . WAITING_FOR_AUTOMATIC_SUBMIT ,
294- icon : CONST . NEXT_STEP . ICONS . HOURGLASS ,
295- actorAccountID : currentUserAccountID ,
296- eta : {
297- dateTime : format ( DateUtils . getNextNthOfMonth ( 2 ) , 'yyyy-MM-dd' ) ,
298- } ,
299- } ;
300- const result = buildOptimisticNextStep ( {
301- report,
302- policy : {
303- ...policy ,
304- autoReportingFrequency : CONST . POLICY . AUTO_REPORTING_FREQUENCIES . MONTHLY ,
305- autoReportingOffset : 2 ,
306- harvesting : {
307- enabled : true ,
308- } ,
284+ // Waiting for userSubmitter's expense(s) to automatically submit on the 2nd of each month
285+ const expectedResult : ReportNextStep = {
286+ messageKey : CONST . NEXT_STEP . MESSAGE_KEY . WAITING_FOR_AUTOMATIC_SUBMIT ,
287+ icon : CONST . NEXT_STEP . ICONS . HOURGLASS ,
288+ actorAccountID : currentUserAccountID ,
289+ eta : {
290+ dateTime : format ( DateUtils . getNextNthOfMonth ( 2 ) , 'yyyy-MM-dd' ) ,
291+ } ,
292+ } ;
293+ const result = buildOptimisticNextStep ( {
294+ report,
295+ policy : {
296+ ...policy ,
297+ autoReportingFrequency : CONST . POLICY . AUTO_REPORTING_FREQUENCIES . MONTHLY ,
298+ autoReportingOffset : 2 ,
299+ harvesting : {
300+ enabled : true ,
309301 } ,
310- currentUserAccountIDParam : currentUserAccountID ,
311- currentUserEmailParam : currentUserEmail ,
312- hasViolations : false ,
313- isASAPSubmitBetaEnabled : false ,
314- predictedNextStatus : CONST . REPORT . STATUS_NUM . OPEN ,
315- shouldFixViolations : false ,
316- isUnapprove : false ,
317- isReopen : false ,
318- isTrackIntentUser : false ,
319- } ) ;
320-
321- expect ( result ) . toMatchObject ( expectedResult ) ;
322- } finally {
323- // Restore real timers even when the assertion fails, so later tests are unaffected.
324- jest . useRealTimers ( ) ;
325- }
302+ } ,
303+ currentUserAccountIDParam : currentUserAccountID ,
304+ currentUserEmailParam : currentUserEmail ,
305+ hasViolations : false ,
306+ isASAPSubmitBetaEnabled : false ,
307+ predictedNextStatus : CONST . REPORT . STATUS_NUM . OPEN ,
308+ shouldFixViolations : false ,
309+ isUnapprove : false ,
310+ isReopen : false ,
311+ isTrackIntentUser : false ,
312+ } ) ;
313+
314+ expect ( result ) . toMatchObject ( expectedResult ) ;
326315 } ) ;
327316
328317 test ( 'monthly on the last day' , ( ) => {
0 commit comments