diff --git a/src/components/MoneyReportHeaderPrimaryAction/ReviewDuplicatesPrimaryAction.tsx b/src/components/MoneyReportHeaderPrimaryAction/ReviewDuplicatesPrimaryAction.tsx index 371db14f6426..a295efd8334d 100644 --- a/src/components/MoneyReportHeaderPrimaryAction/ReviewDuplicatesPrimaryAction.tsx +++ b/src/components/MoneyReportHeaderPrimaryAction/ReviewDuplicatesPrimaryAction.tsx @@ -52,7 +52,14 @@ function ReviewDuplicatesPrimaryAction({reportID, chatReportID}: SimpleActionPro } else { const transactionID = duplicateTransaction.transactionID; const iouAction = getIOUActionForReportID(moneyRequestReport?.reportID, transactionID); - const createdTransactionThreadReport = createTransactionThreadReport(introSelected, email ?? '', accountID, betas, moneyRequestReport, iouAction); + const createdTransactionThreadReport = createTransactionThreadReport({ + introSelected, + currentUserLogin: email ?? '', + currentUserAccountID: accountID, + betas, + iouReport: moneyRequestReport, + iouReportAction: iouAction, + }); threadID = createdTransactionThreadReport?.reportID; } } diff --git a/src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx b/src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx index f7c6ae1626f3..6131ffeae2da 100644 --- a/src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx +++ b/src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx @@ -456,15 +456,15 @@ function MoneyRequestReportTransactionList({ if (!reportIDToNavigate) { const transaction = sortedTransactions.find((t) => t.transactionID === activeTransactionID); - const transactionThreadReport = createTransactionThreadReport( + const transactionThreadReport = createTransactionThreadReport({ introSelected, - currentUserDetails.email ?? '', - currentUserDetails.accountID, + currentUserLogin: currentUserDetails.email ?? '', + currentUserAccountID: currentUserDetails.accountID, betas, - report, - iouAction, + iouReport: report, + iouReportAction: iouAction, transaction, - ); + }); if (transactionThreadReport) { reportIDToNavigate = transactionThreadReport.reportID; routeParams.reportID = reportIDToNavigate; diff --git a/src/components/MoneyRequestReportView/MoneyRequestReportTransactionsNavigation.tsx b/src/components/MoneyRequestReportView/MoneyRequestReportTransactionsNavigation.tsx index ceb7197b873d..68952caf8a0b 100644 --- a/src/components/MoneyRequestReportView/MoneyRequestReportTransactionsNavigation.tsx +++ b/src/components/MoneyRequestReportView/MoneyRequestReportTransactionsNavigation.tsx @@ -136,15 +136,15 @@ function MoneyRequestReportTransactionsNavigation({currentTransactionID, isFromR } // The transaction thread doesn't exist yet, so we should create it if (!nextThreadReportID) { - const transactionThreadReport = createTransactionThreadReport( + const transactionThreadReport = createTransactionThreadReport({ introSelected, - currentUserEmail ?? '', + currentUserLogin: currentUserEmail ?? '', currentUserAccountID, betas, - parentReport, - nextParentReportAction, - nextTransaction, - ); + iouReport: parentReport, + iouReportAction: nextParentReportAction, + transaction: nextTransaction, + }); navigationParams.reportID = transactionThreadReport?.reportID; } // Wait for the next frame to ensure Onyx has processed the optimistic data updates from setOptimisticTransactionThread or createTransactionThreadReport before navigating @@ -172,15 +172,15 @@ function MoneyRequestReportTransactionsNavigation({currentTransactionID, isFromR } // The transaction thread doesn't exist yet, so we should create it if (!prevThreadReportID) { - const transactionThreadReport = createTransactionThreadReport( + const transactionThreadReport = createTransactionThreadReport({ introSelected, - currentUserEmail ?? '', + currentUserLogin: currentUserEmail ?? '', currentUserAccountID, betas, - parentReport, - prevParentReportAction, - prevTransaction, - ); + iouReport: parentReport, + iouReportAction: prevParentReportAction, + transaction: prevTransaction, + }); navigationParams.reportID = transactionThreadReport?.reportID; } // Wait for the next frame to ensure Onyx has processed the optimistic data updates from setOptimisticTransactionThread or createTransactionThreadReport before navigating diff --git a/src/components/ReportActionItem/MoneyRequestAction.tsx b/src/components/ReportActionItem/MoneyRequestAction.tsx index 41d5249a7fbb..447810524a6a 100644 --- a/src/components/ReportActionItem/MoneyRequestAction.tsx +++ b/src/components/ReportActionItem/MoneyRequestAction.tsx @@ -119,7 +119,14 @@ function MoneyRequestAction({ const transactionID = isMoneyRequestAction(action) ? getOriginalMessage(action)?.IOUTransactionID : CONST.DEFAULT_NUMBER_ID; if (!action?.childReportID && transactionID && action.reportActionID) { - const transactionThreadReport = createTransactionThreadReport(introSelected, currentUserEmail ?? '', currentUserAccountID, betas, iouReport, action); + const transactionThreadReport = createTransactionThreadReport({ + introSelected, + currentUserLogin: currentUserEmail ?? '', + currentUserAccountID, + betas, + iouReport, + iouReportAction: action, + }); if (shouldOpenReportInRHP) { Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute({reportID: transactionThreadReport?.reportID, backTo: Navigation.getActiveRoute()})); return; diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 1480bf4a695c..7d917debbdc0 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -11595,8 +11595,11 @@ type PrepareOnboardingOnyxDataParams = { selectedInterestedFeatures?: string[]; isInvitedAccountant?: boolean; onboardingPurposeSelected?: OnboardingPurpose; - isSelfTourViewed?: boolean; betas: OnyxEntry; + // TODO: isSelfTourViewed will be required eventually. Refactor issue: https://github.com/Expensify/App/issues/66424 + isSelfTourViewed?: boolean; + // TODO: hasCompletedGuidedSetupFlow will be required eventually. Refactor issue: https://github.com/Expensify/App/issues/66424 + hasCompletedGuidedSetupFlow?: boolean; }; function getBespokeWelcomeMessage(companySize: OnboardingCompanySize | undefined, userReportedIntegration?: OnboardingAccounting): string { @@ -11652,6 +11655,7 @@ function prepareOnboardingOnyxData({ onboardingPurposeSelected, isSelfTourViewed, betas, + hasCompletedGuidedSetupFlow, }: PrepareOnboardingOnyxDataParams) { if (engagementChoice === CONST.ONBOARDING_CHOICES.PERSONAL_SPEND) { // eslint-disable-next-line no-param-reassign @@ -12208,7 +12212,7 @@ function prepareOnboardingOnyxData({ failureData.push({ onyxMethod: Onyx.METHOD.MERGE, key: ONYXKEYS.NVP_ONBOARDING, - value: {hasCompletedGuidedSetupFlow: onboarding?.hasCompletedGuidedSetupFlow ?? null}, + value: {hasCompletedGuidedSetupFlow: hasCompletedGuidedSetupFlow ?? onboarding?.hasCompletedGuidedSetupFlow ?? null}, }); } diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index 599f339ba9c4..e254f14e2f06 100644 --- a/src/libs/SearchUIUtils.ts +++ b/src/libs/SearchUIUtils.ts @@ -2519,16 +2519,16 @@ function createAndOpenSearchTransactionThread( const transaction = shouldPassTransactionData ? getTransactionFromTransactionListItem(item) : undefined; const transactionViolations = shouldPassTransactionData ? item.violations : undefined; const reportActionToPass = iouReportAction ?? item.reportAction ?? ({reportActionID} as OnyxTypes.ReportAction); - transactionThreadReport = createTransactionThreadReport( + transactionThreadReport = createTransactionThreadReport({ introSelected, - currentUserLogin ?? '', + currentUserLogin: currentUserLogin ?? '', currentUserAccountID, betas, - getReportOrDraftReport(item.reportID) ?? item.report, - reportActionToPass, + iouReport: getReportOrDraftReport(item.reportID) ?? item.report, + iouReportAction: reportActionToPass, transaction, transactionViolations, - ); + }); } if (shouldNavigate) { diff --git a/src/libs/actions/IOU/BulkEdit.ts b/src/libs/actions/IOU/BulkEdit.ts index 888f5b682bf6..f71b0fe134d9 100644 --- a/src/libs/actions/IOU/BulkEdit.ts +++ b/src/libs/actions/IOU/BulkEdit.ts @@ -138,7 +138,15 @@ function updateMultipleMoneyRequests({ // bulk-edit comments are visible immediately while still offline. let didCreateThreadInThisIteration = false; if (!transactionThreadReportID && iouReport?.reportID) { - const optimisticTransactionThread = createTransactionThreadReport(introSelected, currentUserLogin, currentUserAccountID, betas, iouReport, reportAction, transaction); + const optimisticTransactionThread = createTransactionThreadReport({ + introSelected, + currentUserLogin, + currentUserAccountID, + betas, + iouReport, + iouReportAction: reportAction, + transaction, + }); if (optimisticTransactionThread?.reportID) { transactionThreadReportID = optimisticTransactionThread.reportID; transactionThread = optimisticTransactionThread; diff --git a/src/libs/actions/Report/index.ts b/src/libs/actions/Report/index.ts index 142a9a3c61d8..a74fa74d8f54 100644 --- a/src/libs/actions/Report/index.ts +++ b/src/libs/actions/Report/index.ts @@ -344,6 +344,10 @@ type OpenReportActionParams = { // TODO: This will be required eventually. Refactor issue: https://github.com/Expensify/App/issues/66424 isSelfTourViewed?: boolean; + /** Whether the user has completed the guided setup flow */ + // TODO: This will be required eventually. Refactor issue: https://github.com/Expensify/App/issues/66424 + hasCompletedGuidedSetupFlow?: boolean; + /** Beta features list */ betas: OnyxEntry; }; @@ -1306,9 +1310,11 @@ function getGuidedSetupDataForOpenReport( betas: OnyxEntry, // TODO: This will be required eventually. Refactor issue: https://github.com/Expensify/App/issues/66424 isSelfTourViewed?: boolean, + // TODO: This will be required eventually. Refactor issue: https://github.com/Expensify/App/issues/66424 + hasCompletedGuidedSetupFlow?: boolean, ): GuidedSetupDataForOpenReport | undefined { const isInviteOnboardingComplete = introSelected?.isInviteOnboardingComplete ?? false; - const isOnboardingCompleted = onboarding?.hasCompletedGuidedSetupFlow ?? false; + const isOnboardingCompleted = hasCompletedGuidedSetupFlow ?? onboarding?.hasCompletedGuidedSetupFlow ?? false; // Some cases we can have two open report requests with guide setup data because isInviteOnboardingComplete is not updated completely. // Then we need to check the list request and prevent the guided setup data from being duplicated. @@ -1341,6 +1347,7 @@ function getGuidedSetupDataForOpenReport( onboardingMessage, companySize: introSelected?.companySize as OnboardingCompanySize, isSelfTourViewed, + hasCompletedGuidedSetupFlow, betas, }); @@ -1388,6 +1395,7 @@ function openReport(params: OpenReportActionParams) { currentUserLogin, currentUserAccountID, isSelfTourViewed, + hasCompletedGuidedSetupFlow, betas, } = params; if (!reportID) { @@ -1619,7 +1627,7 @@ function openReport(params: OpenReportActionParams) { }); } - const guidedSetup = getGuidedSetupDataForOpenReport(introSelected, betas, isSelfTourViewed); + const guidedSetup = getGuidedSetupDataForOpenReport(introSelected, betas, isSelfTourViewed, hasCompletedGuidedSetupFlow); if (guidedSetup) { optimisticData.push(...guidedSetup.optimisticData); successData.push(...guidedSetup.successData); @@ -2022,18 +2030,59 @@ function getOptimisticChatReport(accountID: number, currentUserAccountID: number }); } -function createTransactionThreadReport( - introSelected: OnyxEntry, - currentUserLogin: string, - currentUserAccountID: number, - betas: OnyxEntry, - iouReport?: OnyxEntry, - iouReportAction?: OnyxEntry, - transaction?: Transaction, - transactionViolations?: TransactionViolations, +type CreateTransactionThreadReportParams = { + /** The intro selected by the user */ + introSelected: OnyxEntry; + + /** The current user's login */ + currentUserLogin: string; + + /** The current user's account ID */ + currentUserAccountID: number; + + /** Beta features list */ + betas: OnyxEntry; + + /** The IOU report that the transaction thread is being created from */ + iouReport?: OnyxEntry; + + /** The IOU report action that the transaction thread is being created from */ + iouReportAction?: OnyxEntry; + + /** The transaction object for legacy transactions that don't have a transaction thread or money request preview yet */ + transaction?: Transaction; + + /** The violations for the transaction, if any */ + transactionViolations?: TransactionViolations; + // TODO: personalDetails should be a required field in follow-up PRs https://github.com/Expensify/App/issues/73656 - personalDetails?: OnyxEntry, -): OptimisticChatReport | undefined { + /** The personal details of the participants */ + personalDetails?: OnyxEntry; + + /** Whether the user has seen the self tour */ + // TODO: This will be required eventually. Refactor issue: https://github.com/Expensify/App/issues/66424 + isSelfTourViewed?: boolean; + + /** Whether the user has completed the guided setup flow */ + // TODO: This will be required eventually. Refactor issue: https://github.com/Expensify/App/issues/66424 + hasCompletedGuidedSetupFlow?: boolean; +}; + +function createTransactionThreadReport(params: CreateTransactionThreadReportParams): OptimisticChatReport | undefined { + const { + introSelected, + currentUserLogin, + currentUserAccountID, + betas, + iouReport, + iouReportAction, + transaction, + transactionViolations, + personalDetails, + isSelfTourViewed, + hasCompletedGuidedSetupFlow, + } = params; + // Determine if we need selfDM report (for track expenses or unreported transactions) const isTrackExpense = !iouReport && ReportActionsUtils.isTrackExpenseAction(iouReportAction); const isUnreportedTransaction = transaction?.reportID === CONST.REPORT.UNREPORTED_REPORT_ID; @@ -2088,6 +2137,8 @@ function createTransactionThreadReport( optimisticSelfDMReport, currentUserLogin, currentUserAccountID, + isSelfTourViewed, + hasCompletedGuidedSetupFlow, betas, }); return optimisticTransactionThread; @@ -7669,7 +7720,7 @@ function clearConciergeThinkingKickoff() { Onyx.set(ONYXKEYS.CONCIERGE_THINKING_KICKOFF, null); } -export type {Video, GuidedSetupData, TaskForParameters, IntroSelected, OpenReportActionParams, ParticipantInfo}; +export type {Video, GuidedSetupData, TaskForParameters, IntroSelected, OpenReportActionParams, ParticipantInfo, CreateTransactionThreadReportParams}; export { addAttachmentWithComment, diff --git a/src/pages/Search/SearchMoneyRequestReportPage.tsx b/src/pages/Search/SearchMoneyRequestReportPage.tsx index 538496f27f3f..aae41bdc2d11 100644 --- a/src/pages/Search/SearchMoneyRequestReportPage.tsx +++ b/src/pages/Search/SearchMoneyRequestReportPage.tsx @@ -199,7 +199,14 @@ function SearchMoneyRequestReportPage({route}: SearchMoneyRequestPageProps) { if (transactionThreadReportID === CONST.FAKE_REPORT_ID && oneTransactionID) { const iouAction = getIOUActionForTransactionID(reportActions, oneTransactionID); - createTransactionThreadReport(introSelected, currentUserEmail ?? '', currentUserAccountID, betas, report, iouAction); + createTransactionThreadReport({ + introSelected, + currentUserLogin: currentUserEmail ?? '', + currentUserAccountID, + betas, + iouReport: report, + iouReportAction: iouAction, + }); return; } @@ -267,7 +274,15 @@ function SearchMoneyRequestReportPage({route}: SearchMoneyRequestPageProps) { hasCreatedLegacyThreadRef.current = true; const violations = allReportViolations[transaction.transactionID] ?? snapshotViolations; - createTransactionThreadReport(introSelected, currentUserEmail ?? '', currentUserAccountID, betas, report, undefined, transaction, violations); + createTransactionThreadReport({ + introSelected, + currentUserLogin: currentUserEmail ?? '', + currentUserAccountID, + betas, + iouReport: report, + transaction, + transactionViolations: violations, + }); }, [ allReportTransactions, allReportViolations, diff --git a/src/pages/inbox/ReportFetchHandler.tsx b/src/pages/inbox/ReportFetchHandler.tsx index 89b970954842..1c131a3a2bd5 100644 --- a/src/pages/inbox/ReportFetchHandler.tsx +++ b/src/pages/inbox/ReportFetchHandler.tsx @@ -140,7 +140,15 @@ function ReportFetchHandler() { ); const oneTransactionID = currentReportTransactions.at(0)?.transactionID; const iouAction = getIOUActionForReportID(reportID, oneTransactionID); - createTransactionThreadReport(introSelected, currentUserEmail ?? '', currentUserAccountID, betas, report, iouAction, currentReportTransactions.at(0)); + createTransactionThreadReport({ + introSelected, + currentUserLogin: currentUserEmail ?? '', + currentUserAccountID, + betas, + iouReport: report, + iouReportAction: iouAction, + transaction: currentReportTransactions.at(0), + }); }); const onUnmount = useEffectEvent(() => { @@ -341,7 +349,14 @@ function ReportFetchHandler() { // For legacy transactions, pass undefined as IOU action and the transaction object // It will be created optimistically and in the backend when call openReport - createTransactionThreadReport(introSelected, currentUserEmail ?? '', currentUserAccountID, betas, report, undefined, transaction); + createTransactionThreadReport({ + introSelected, + currentUserLogin: currentUserEmail ?? '', + currentUserAccountID, + betas, + iouReport: report, + transaction, + }); }, [ introSelected, currentUserEmail, diff --git a/src/pages/inbox/report/actionContents/ChatTransactionPreview.tsx b/src/pages/inbox/report/actionContents/ChatTransactionPreview.tsx index 449d47f683be..ffde941139d1 100644 --- a/src/pages/inbox/report/actionContents/ChatTransactionPreview.tsx +++ b/src/pages/inbox/report/actionContents/ChatTransactionPreview.tsx @@ -70,7 +70,14 @@ function ChatTransactionPreview({action, reportID, originalReportID, chatReportI // If no childReportID exists, create transaction thread on-demand if (!action.childReportID) { - const createdTransactionThreadReport = createTransactionThreadReport(introSelected, personalDetail.email ?? '', personalDetail.accountID, betas, iouReport, action); + const createdTransactionThreadReport = createTransactionThreadReport({ + introSelected, + currentUserLogin: personalDetail.email ?? '', + currentUserAccountID: personalDetail.accountID, + betas, + iouReport, + iouReportAction: action, + }); if (createdTransactionThreadReport?.reportID) { Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(createdTransactionThreadReport.reportID, undefined, undefined, Navigation.getActiveRoute())); return; diff --git a/tests/actions/ReportTest.ts b/tests/actions/ReportTest.ts index 6b7cb2cb4a05..aea948156f19 100644 --- a/tests/actions/ReportTest.ts +++ b/tests/actions/ReportTest.ts @@ -7178,13 +7178,24 @@ describe('actions/Report', () => { }); it('should return undefined when no valid report is provided', () => { - const result = Report.createTransactionThreadReport(TEST_INTRO_SELECTED, TEST_USER_LOGIN, TEST_USER_ACCOUNT_ID, undefined, undefined, undefined); + const result = Report.createTransactionThreadReport({ + introSelected: TEST_INTRO_SELECTED, + currentUserLogin: TEST_USER_LOGIN, + currentUserAccountID: TEST_USER_ACCOUNT_ID, + betas: undefined, + }); expect(result).toBeUndefined(); }); it('should return undefined when report has no reportID', () => { const reportWithoutID = {} as OnyxTypes.Report; - const result = Report.createTransactionThreadReport(TEST_INTRO_SELECTED, TEST_USER_LOGIN, TEST_USER_ACCOUNT_ID, undefined, reportWithoutID, undefined); + const result = Report.createTransactionThreadReport({ + introSelected: TEST_INTRO_SELECTED, + currentUserLogin: TEST_USER_LOGIN, + currentUserAccountID: TEST_USER_ACCOUNT_ID, + betas: undefined, + iouReport: reportWithoutID, + }); expect(result).toBeUndefined(); }); @@ -7204,7 +7215,14 @@ describe('actions/Report', () => { actionName: CONST.REPORT.ACTIONS.TYPE.IOU, }; - const result = Report.createTransactionThreadReport(TEST_INTRO_SELECTED, TEST_USER_LOGIN, TEST_USER_ACCOUNT_ID, undefined, parentReport, reportAction); + const result = Report.createTransactionThreadReport({ + introSelected: TEST_INTRO_SELECTED, + currentUserLogin: TEST_USER_LOGIN, + currentUserAccountID: TEST_USER_ACCOUNT_ID, + betas: undefined, + iouReport: parentReport, + iouReportAction: reportAction, + }); expect(result).toBeDefined(); expect(result?.reportID).toBeDefined(); @@ -7233,7 +7251,14 @@ describe('actions/Report', () => { }; // Should not throw when called with introSelected and return a valid thread report - const result = Report.createTransactionThreadReport(introSelected, TEST_USER_LOGIN, TEST_USER_ACCOUNT_ID, undefined, parentReport, reportAction); + const result = Report.createTransactionThreadReport({ + introSelected, + currentUserLogin: TEST_USER_LOGIN, + currentUserAccountID: TEST_USER_ACCOUNT_ID, + betas: undefined, + iouReport: parentReport, + iouReportAction: reportAction, + }); expect(result).toBeDefined(); expect(result?.reportID).toBeDefined(); expect(result?.parentReportID).toBe(parentReport.reportID); @@ -7256,7 +7281,14 @@ describe('actions/Report', () => { }; // Should work fine with undefined introSelected - it's OnyxEntry which allows undefined - const result = Report.createTransactionThreadReport(undefined, TEST_USER_LOGIN, TEST_USER_ACCOUNT_ID, undefined, parentReport, reportAction); + const result = Report.createTransactionThreadReport({ + introSelected: undefined, + currentUserLogin: TEST_USER_LOGIN, + currentUserAccountID: TEST_USER_ACCOUNT_ID, + betas: undefined, + iouReport: parentReport, + iouReportAction: reportAction, + }); expect(result).toBeDefined(); expect(result?.reportID).toBeDefined(); }); @@ -7285,7 +7317,16 @@ describe('actions/Report', () => { }, ]; - const result = Report.createTransactionThreadReport(TEST_INTRO_SELECTED, TEST_USER_LOGIN, TEST_USER_ACCOUNT_ID, undefined, parentReport, reportAction, transaction, violations); + const result = Report.createTransactionThreadReport({ + introSelected: TEST_INTRO_SELECTED, + currentUserLogin: TEST_USER_LOGIN, + currentUserAccountID: TEST_USER_ACCOUNT_ID, + betas: undefined, + iouReport: parentReport, + iouReportAction: reportAction, + transaction, + transactionViolations: violations, + }); expect(result).toBeDefined(); expect(result?.reportID).toBeDefined(); expect(result?.parentReportID).toBe(parentReport.reportID); @@ -7308,7 +7349,14 @@ describe('actions/Report', () => { }; const testBetas = [CONST.BETAS.ALL]; - Report.createTransactionThreadReport(TEST_INTRO_SELECTED, TEST_USER_LOGIN, TEST_USER_ACCOUNT_ID, testBetas, parentReport, reportAction); + Report.createTransactionThreadReport({ + introSelected: TEST_INTRO_SELECTED, + currentUserLogin: TEST_USER_LOGIN, + currentUserAccountID: TEST_USER_ACCOUNT_ID, + betas: testBetas, + iouReport: parentReport, + iouReportAction: reportAction, + }); await waitForBatchedUpdates(); TestHelper.expectAPICommandToHaveBeenCalled(WRITE_COMMANDS.OPEN_REPORT, 1); diff --git a/tests/unit/Search/SearchUIUtilsTest.ts b/tests/unit/Search/SearchUIUtilsTest.ts index 35bfd2d318ea..04c5e6d9aed8 100644 --- a/tests/unit/Search/SearchUIUtilsTest.ts +++ b/tests/unit/Search/SearchUIUtilsTest.ts @@ -8486,7 +8486,16 @@ describe('SearchUIUtils', () => { expect(setOptimisticDataForTransactionThreadPreview).toHaveBeenCalled(); // The full reportAction is passed to preserve originalMessage.type for proper expense type detection - expect(createTransactionThreadReport).toHaveBeenCalledWith(introSelectedData, currentUserLogin, currentUserAccountID, undefined, report1, reportAction1, undefined, undefined); + expect(createTransactionThreadReport).toHaveBeenCalledWith({ + introSelected: introSelectedData, + currentUserLogin, + currentUserAccountID, + betas: undefined, + iouReport: report1, + iouReportAction: reportAction1, + transaction: undefined, + transactionViolations: undefined, + }); }); test('Should not navigate if shouldNavigate = false', () => { @@ -8567,7 +8576,7 @@ describe('SearchUIUtils', () => { false, ); - expect(((createTransactionThreadReport as jest.Mock).mock.calls.at(0) as unknown[] | undefined)?.at(0)).toEqual(customIntroSelected); + expect(jest.mocked(createTransactionThreadReport).mock.calls.at(0)?.at(0)?.introSelected).toEqual(customIntroSelected); }); test('Should pass undefined introSelected without bypassing with empty values', () => { @@ -8575,7 +8584,7 @@ describe('SearchUIUtils', () => { SearchUIUtils.createAndOpenSearchTransactionThread(transactionListItem, undefined, backTo, currentUserLogin, currentUserAccountID, undefined, threadReportID, undefined, false); - expect(((createTransactionThreadReport as jest.Mock).mock.calls.at(0) as unknown[] | undefined)?.at(0)).toBeUndefined(); + expect(jest.mocked(createTransactionThreadReport).mock.calls.at(0)?.at(0)?.introSelected).toBeUndefined(); }); });