diff --git a/tests/unit/ReportSecondaryActionUtilsTest.ts b/tests/unit/ReportSecondaryActionUtilsTest.ts index 8fa30c96f4d6a..04495f98a77ed 100644 --- a/tests/unit/ReportSecondaryActionUtilsTest.ts +++ b/tests/unit/ReportSecondaryActionUtilsTest.ts @@ -923,6 +923,9 @@ describe('getSecondaryAction', () => { const TRANSACTION_ID = 'transaction_id'; await Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${REPORT_ID}`, report); + // Use tomorrow's date to ensure we're always before the NACHA cutoff (23:45 UTC) + const tomorrow = new Date(); + tomorrow.setDate(tomorrow.getDate() + 1); const ACTION_ID = 'action_id'; const reportAction = { actionID: ACTION_ID, @@ -931,7 +934,7 @@ describe('getSecondaryAction', () => { IOUTransactionID: TRANSACTION_ID, type: CONST.IOU.REPORT_ACTION_TYPE.PAY, }, - created: new Date().toISOString(), + created: tomorrow.toISOString(), } as unknown as ReportAction; await Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${REPORT_ID}`, {[ACTION_ID]: reportAction}); @@ -970,6 +973,9 @@ describe('getSecondaryAction', () => { const TRANSACTION_ID = 'transaction_id'; await Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${REPORT_ID}`, report); + // Use tomorrow's date to ensure we're always before the NACHA cutoff (23:45 UTC) + const tomorrow = new Date(); + tomorrow.setDate(tomorrow.getDate() + 1); const ACTION_ID = 'action_id'; const reportAction = { actionID: ACTION_ID, @@ -979,7 +985,7 @@ describe('getSecondaryAction', () => { type: CONST.IOU.REPORT_ACTION_TYPE.PAY, paymentType: CONST.IOU.PAYMENT_TYPE.VBBA, }, - created: new Date().toISOString(), + created: tomorrow.toISOString(), } as unknown as ReportAction; await Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${REPORT_ID}`, {[ACTION_ID]: reportAction}); @@ -1018,6 +1024,9 @@ describe('getSecondaryAction', () => { const TRANSACTION_ID = 'transaction_id'; await Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${REPORT_ID}`, report); + // Use tomorrow's date to ensure we're always before the NACHA cutoff (23:45 UTC) + const tomorrow = new Date(); + tomorrow.setDate(tomorrow.getDate() + 1); const ACTION_ID = 'action_id'; const reportAction = { actionID: ACTION_ID, @@ -1027,7 +1036,7 @@ describe('getSecondaryAction', () => { type: CONST.IOU.REPORT_ACTION_TYPE.PAY, paymentType: CONST.IOU.PAYMENT_TYPE.VBBA, }, - created: new Date().toISOString(), + created: tomorrow.toISOString(), } as unknown as ReportAction; await Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${REPORT_ID}`, {[ACTION_ID]: reportAction}); @@ -1066,6 +1075,9 @@ describe('getSecondaryAction', () => { const TRANSACTION_ID = 'transaction_id'; await Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${REPORT_ID}`, report); + // Use tomorrow's date to ensure we're always before the NACHA cutoff (23:45 UTC) + const tomorrow = new Date(); + tomorrow.setDate(tomorrow.getDate() + 1); const ACTION_ID = 'action_id'; const reportAction = { actionID: ACTION_ID, @@ -1075,7 +1087,7 @@ describe('getSecondaryAction', () => { type: CONST.IOU.REPORT_ACTION_TYPE.PAY, paymentType: CONST.IOU.PAYMENT_TYPE.VBBA, }, - created: new Date().toISOString(), + created: tomorrow.toISOString(), } as unknown as ReportAction; await Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${REPORT_ID}`, {[ACTION_ID]: reportAction});