From 65cdaaa7f23f2580992ab3df18b8ad7ea0803852 Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Fri, 15 May 2026 09:57:13 +0700 Subject: [PATCH] refactor: extract remaining setters from IOU/index.ts to MoneyRequest.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Moves the final 16 setter functions (the field-level setters that remained after PRs #90157, #90299, and the tax/distance/time PR): - setMoneyRequestReceiptState - setMoneyRequestAmount, clearMoneyRequestAmount, clearMoneyRequestMerchant - setMoneyRequestCreated, setMoneyRequestDateAttribute - setMoneyRequestCurrency, setMoneyRequestDescription, setMoneyRequestMerchant - setMoneyRequestAttendees, setMoneyRequestAccountant - setMoneyRequestPendingFields, setMoneyRequestTag - setMoneyRequestBillable, setMoneyRequestReimbursable - setMoneyRequestReportID After this PR, IOU/index.ts contains only Onyx vars, getters, and shared types — no setters. Stacked on top of the previous setter PR (this branch depends on it landing first). Co-Authored-By: Claude Opus 4.7 (1M context) --- .../DistanceRequestController.tsx | 3 +- .../FieldAutoSelector.tsx | 3 +- .../sections/AmountField.tsx | 3 +- .../sections/DescriptionField.tsx | 2 +- .../sections/MerchantField.tsx | 2 +- .../Modal/EmployeeTestDriveModal.tsx | 10 +- src/hooks/useParticipantSubmission.ts | 2 +- src/libs/ReportUtils.ts | 11 +- src/libs/actions/IOU/MoneyRequest.ts | 101 +++++++++++++++++- src/libs/actions/IOU/index.ts | 97 +---------------- src/pages/Share/SubmitDetailsPage.tsx | 3 +- .../request/step/IOURequestStepAccountant.tsx | 2 +- .../iou/request/step/IOURequestStepAmount.tsx | 9 +- .../request/step/IOURequestStepAttendees.tsx | 2 +- .../step/IOURequestStepConfirmation.tsx | 2 +- .../iou/request/step/IOURequestStepDate.tsx | 2 +- .../step/IOURequestStepDescription.tsx | 2 +- .../step/IOURequestStepDestination.tsx | 10 +- .../hooks/useDistanceRequestData.ts | 2 +- .../iou/request/step/IOURequestStepHours.tsx | 3 +- .../request/step/IOURequestStepMerchant.tsx | 2 +- .../iou/request/step/IOURequestStepTag.tsx | 2 +- .../step/IOURequestStepTaxAmountPage.tsx | 3 +- .../iou/request/step/IOURequestStepTime.tsx | 3 +- .../request/step/IOURequestStepTimeRate.tsx | 3 +- .../confirmation/ExpenseDefaultsSetter.tsx | 2 +- tests/actions/IOU/IOUSettersTest.ts | 5 +- tests/actions/IOUTest.ts | 14 ++- tests/ui/IOURequestStepHoursTest.tsx | 4 +- tests/ui/IOURequestStepTimeRateTest.tsx | 4 +- 30 files changed, 172 insertions(+), 141 deletions(-) diff --git a/src/components/MoneyRequestConfirmationList/DistanceRequestController.tsx b/src/components/MoneyRequestConfirmationList/DistanceRequestController.tsx index cbeccc49c05a..cfe46ef4c386 100644 --- a/src/components/MoneyRequestConfirmationList/DistanceRequestController.tsx +++ b/src/components/MoneyRequestConfirmationList/DistanceRequestController.tsx @@ -4,8 +4,7 @@ import {useCurrencyListActions} from '@hooks/useCurrencyList'; import useLocalize from '@hooks/useLocalize'; import useOnyx from '@hooks/useOnyx'; import usePrevious from '@hooks/usePrevious'; -import {setMoneyRequestAmount, setMoneyRequestMerchant, setMoneyRequestPendingFields} from '@libs/actions/IOU'; -import {setCustomUnitRateID} from '@libs/actions/IOU/MoneyRequest'; +import {setCustomUnitRateID, setMoneyRequestAmount, setMoneyRequestMerchant, setMoneyRequestPendingFields} from '@libs/actions/IOU/MoneyRequest'; import {setSplitShares} from '@libs/actions/IOU/Split'; import DistanceRequestUtils from '@libs/DistanceRequestUtils'; import type {MileageRate} from '@libs/DistanceRequestUtils'; diff --git a/src/components/MoneyRequestConfirmationList/FieldAutoSelector.tsx b/src/components/MoneyRequestConfirmationList/FieldAutoSelector.tsx index 9d9404ee47f2..63620e3b476d 100644 --- a/src/components/MoneyRequestConfirmationList/FieldAutoSelector.tsx +++ b/src/components/MoneyRequestConfirmationList/FieldAutoSelector.tsx @@ -1,8 +1,7 @@ import {useEffect} from 'react'; import type {OnyxEntry} from 'react-native-onyx'; import type {ValueOf} from 'type-fest'; -import {setMoneyRequestTag} from '@libs/actions/IOU'; -import {setMoneyRequestCategory} from '@libs/actions/IOU/MoneyRequest'; +import {setMoneyRequestCategory, setMoneyRequestTag} from '@libs/actions/IOU/MoneyRequest'; import {insertTagIntoTransactionTagsString} from '@libs/IOUUtils'; import {getTag} from '@libs/TransactionUtils'; import type {Policy, PolicyCategories, PolicyTagLists, Transaction} from '@src/types/onyx'; diff --git a/src/components/MoneyRequestConfirmationList/sections/AmountField.tsx b/src/components/MoneyRequestConfirmationList/sections/AmountField.tsx index bfed3d20459f..7c5b09e98b29 100644 --- a/src/components/MoneyRequestConfirmationList/sections/AmountField.tsx +++ b/src/components/MoneyRequestConfirmationList/sections/AmountField.tsx @@ -10,8 +10,7 @@ import useLocalize from '@hooks/useLocalize'; import useOnyx from '@hooks/useOnyx'; import useScreenWrapperTransitionStatus from '@hooks/useScreenWrapperTransitionStatus'; import useThemeStyles from '@hooks/useThemeStyles'; -import {clearMoneyRequestAmount, setMoneyRequestAmount} from '@libs/actions/IOU'; -import {getMoneyRequestParticipantsFromReport} from '@libs/actions/IOU/MoneyRequest'; +import {clearMoneyRequestAmount, getMoneyRequestParticipantsFromReport, setMoneyRequestAmount} from '@libs/actions/IOU/MoneyRequest'; import {convertToBackendAmount, convertToFrontendAmountAsString, getLocalizedCurrencySymbol} from '@libs/CurrencyUtils'; import {calculateAmount} from '@libs/IOUUtils'; import Navigation from '@libs/Navigation/Navigation'; diff --git a/src/components/MoneyRequestConfirmationList/sections/DescriptionField.tsx b/src/components/MoneyRequestConfirmationList/sections/DescriptionField.tsx index d53dcf18d5fe..ed044eceeda9 100644 --- a/src/components/MoneyRequestConfirmationList/sections/DescriptionField.tsx +++ b/src/components/MoneyRequestConfirmationList/sections/DescriptionField.tsx @@ -8,7 +8,7 @@ import TextInput from '@components/TextInput'; import useLocalize from '@hooks/useLocalize'; import useOnyx from '@hooks/useOnyx'; import useThemeStyles from '@hooks/useThemeStyles'; -import {setMoneyRequestDescription} from '@libs/actions/IOU'; +import {setMoneyRequestDescription} from '@libs/actions/IOU/MoneyRequest'; import Navigation from '@libs/Navigation/Navigation'; import Parser from '@libs/Parser'; import {getDescription, hasReceipt} from '@libs/TransactionUtils'; diff --git a/src/components/MoneyRequestConfirmationList/sections/MerchantField.tsx b/src/components/MoneyRequestConfirmationList/sections/MerchantField.tsx index 928bf9bb3b73..19b49e77a45e 100644 --- a/src/components/MoneyRequestConfirmationList/sections/MerchantField.tsx +++ b/src/components/MoneyRequestConfirmationList/sections/MerchantField.tsx @@ -6,7 +6,7 @@ import TextInput from '@components/TextInput'; import useLocalize from '@hooks/useLocalize'; import useOnyx from '@hooks/useOnyx'; import useThemeStyles from '@hooks/useThemeStyles'; -import {clearMoneyRequestMerchant, setMoneyRequestMerchant} from '@libs/actions/IOU'; +import {clearMoneyRequestMerchant, setMoneyRequestMerchant} from '@libs/actions/IOU/MoneyRequest'; import Navigation from '@libs/Navigation/Navigation'; import {getMerchant, hasReceipt} from '@libs/TransactionUtils'; import {isValidInputLength} from '@libs/ValidationUtils'; diff --git a/src/components/TestDrive/Modal/EmployeeTestDriveModal.tsx b/src/components/TestDrive/Modal/EmployeeTestDriveModal.tsx index 1d8fa7656b32..b68cb267a67b 100644 --- a/src/components/TestDrive/Modal/EmployeeTestDriveModal.tsx +++ b/src/components/TestDrive/Modal/EmployeeTestDriveModal.tsx @@ -12,8 +12,14 @@ import useLocalize from '@hooks/useLocalize'; import useOnboardingMessages from '@hooks/useOnboardingMessages'; import useOnyx from '@hooks/useOnyx'; import usePersonalPolicy from '@hooks/usePersonalPolicy'; -import {setMoneyRequestAmount, setMoneyRequestCreated, setMoneyRequestDescription, setMoneyRequestMerchant} from '@libs/actions/IOU'; -import {initMoneyRequest, setMoneyRequestParticipants} from '@libs/actions/IOU/MoneyRequest'; +import { + initMoneyRequest, + setMoneyRequestAmount, + setMoneyRequestCreated, + setMoneyRequestDescription, + setMoneyRequestMerchant, + setMoneyRequestParticipants, +} from '@libs/actions/IOU/MoneyRequest'; import {setMoneyRequestReceipt} from '@libs/actions/IOU/Receipt'; import {verifyTestDriveRecipient} from '@libs/actions/Onboarding'; import setTestReceipt from '@libs/actions/setTestReceipt'; diff --git a/src/hooks/useParticipantSubmission.ts b/src/hooks/useParticipantSubmission.ts index 4594a8d27a21..5706d25b2355 100644 --- a/src/hooks/useParticipantSubmission.ts +++ b/src/hooks/useParticipantSubmission.ts @@ -9,13 +9,13 @@ import {isPaidGroupPolicy} from '@libs/PolicyUtils'; import {findSelfDMReportID, generateReportID, isInvoiceRoomWithID} from '@libs/ReportUtils'; import {shouldRestrictUserBillableActions} from '@libs/SubscriptionUtils'; import {isDistanceRequest} from '@libs/TransactionUtils'; -import {setMoneyRequestTag} from '@userActions/IOU'; import { resetDraftTransactionsCustomUnit, setCustomUnitRateID, setMoneyRequestCategory, setMoneyRequestParticipants, setMoneyRequestParticipantsFromReport, + setMoneyRequestTag, } from '@userActions/IOU/MoneyRequest'; import {setSplitShares} from '@userActions/IOU/Split'; import {createDraftWorkspace, generateDefaultWorkspaceName} from '@userActions/Policy/Policy'; diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 093c5ae605bd..03f656b7260f 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -86,10 +86,17 @@ import type {FileObject} from '@src/types/utils/Attachment'; import {isEmptyObject, isEmptyValueObject} from '@src/types/utils/EmptyObject'; import type IconAsset from '@src/types/utils/IconAsset'; import {getBankAccountFromID} from './actions/BankAccounts'; -import {getUserAccountID, setMoneyRequestReportID} from './actions/IOU'; +import {getUserAccountID} from './actions/IOU'; import type {IOURequestType} from './actions/IOU'; import {unholdRequest} from './actions/IOU/Hold'; -import {createDraftTransaction, setMoneyRequestParticipants, setMoneyRequestParticipantsFromReport, startDistanceRequest, startMoneyRequest} from './actions/IOU/MoneyRequest'; +import { + createDraftTransaction, + setMoneyRequestParticipants, + setMoneyRequestParticipantsFromReport, + setMoneyRequestReportID, + startDistanceRequest, + startMoneyRequest, +} from './actions/IOU/MoneyRequest'; import {canApproveIOU, canIOUBePaid, canSubmitReport, getBadgeFromIOUReport, getIOUReportActionWithBadge} from './actions/IOU/ReportWorkflow'; import {createDraftWorkspace} from './actions/Policy/Policy'; import hasCreditBankAccount from './actions/ReimbursementAccount/hasCreditBankAccount'; diff --git a/src/libs/actions/IOU/MoneyRequest.ts b/src/libs/actions/IOU/MoneyRequest.ts index 6052d1026e1a..3b1319d1795a 100644 --- a/src/libs/actions/IOU/MoneyRequest.ts +++ b/src/libs/actions/IOU/MoneyRequest.ts @@ -61,13 +61,13 @@ import type { TransactionViolation, } from '@src/types/onyx'; import type {ReportAttributes, ReportAttributesDerivedValue} from '@src/types/onyx/DerivedValues'; -import type {Participant} from '@src/types/onyx/IOU'; +import type {Accountant, Attendee, Participant} from '@src/types/onyx/IOU'; import type {CurrentUserPersonalDetails} from '@src/types/onyx/PersonalDetails'; import type {Unit} from '@src/types/onyx/Policy'; import type {Comment, Receipt, WaypointCollection} from '@src/types/onyx/Transaction'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import type {GpsPoint, IOURequestType} from './index'; -import {getAllTransactionDrafts, setMoneyRequestMerchant, setMoneyRequestPendingFields} from './index'; +import {getAllTransactionDrafts} from './index'; import {createDistanceRequest, resetSplitShares, startSplitBill} from './Split'; import {requestMoney, trackExpense} from './TrackExpense'; @@ -1314,6 +1314,87 @@ function setMoneyRequestDistanceRate(currentTransaction: OnyxEntry, }); } +function setMoneyRequestReceiptState(transactionID: string, isDraft: boolean, shouldStopSmartscan = false) { + if (!isDraft || !shouldStopSmartscan) { + return; + } + Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {receipt: {state: CONST.IOU.RECEIPT_STATE.OPEN}}); +} + +function setMoneyRequestAmount(transactionID: string, amount: number, currency: string, shouldShowOriginalAmount = false, shouldStopSmartscan = false) { + // Mark that the user has explicitly set the amount. This is used by the new manual expense flow to distinguish + // a default amount of 0 (field empty) from a user-entered 0 (valid $0 expense). + Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {amount, currency, shouldShowOriginalAmount, isAmountSet: true}); + setMoneyRequestReceiptState(transactionID, true, shouldStopSmartscan); +} + +/** + * Clears the amount field back to an empty/unset state in the new manual expense flow. + * Called when the user deletes all characters from the amount input so that the field + * shows as empty and submission is blocked until a value is entered again. + */ +function clearMoneyRequestAmount(transactionID: string) { + Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {amount: 0, isAmountSet: false}); +} + +function clearMoneyRequestMerchant(transactionID: string, isDraft = true) { + Onyx.merge(`${isDraft ? ONYXKEYS.COLLECTION.TRANSACTION_DRAFT : ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, {merchant: '', isMerchantSet: false}); +} + +function setMoneyRequestCreated(transactionID: string, created: string, isDraft: boolean, shouldStopSmartscan = false) { + Onyx.merge(`${isDraft ? ONYXKEYS.COLLECTION.TRANSACTION_DRAFT : ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, {created}); + setMoneyRequestReceiptState(transactionID, isDraft, shouldStopSmartscan); +} + +function setMoneyRequestDateAttribute(transactionID: string, start: string, end: string) { + Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {comment: {customUnit: {attributes: {dates: {start, end}}}}}); +} + +function setMoneyRequestCurrency(transactionID: string, currency: string, isEditing = false) { + const fieldToUpdate = isEditing ? 'modifiedCurrency' : 'currency'; + Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {[fieldToUpdate]: currency}); +} + +function setMoneyRequestDescription(transactionID: string, comment: string, isDraft: boolean, shouldStopSmartscan = false) { + // Trim only when persisting to the real transaction (not a draft) to avoid + // stripping trailing spaces/newlines while the user is still typing. + Onyx.merge(`${isDraft ? ONYXKEYS.COLLECTION.TRANSACTION_DRAFT : ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, {comment: {comment: isDraft ? comment : comment.trim()}}); + setMoneyRequestReceiptState(transactionID, isDraft, shouldStopSmartscan); +} + +function setMoneyRequestMerchant(transactionID: string, merchant: string, isDraft: boolean, shouldStopSmartscan = false) { + Onyx.merge(`${isDraft ? ONYXKEYS.COLLECTION.TRANSACTION_DRAFT : ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, {merchant, isMerchantSet: true}); + setMoneyRequestReceiptState(transactionID, isDraft, shouldStopSmartscan); +} + +function setMoneyRequestAttendees(transactionID: string, attendees: Attendee[], isDraft: boolean) { + Onyx.merge(`${isDraft ? ONYXKEYS.COLLECTION.TRANSACTION_DRAFT : ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, {comment: {attendees}}); +} + +function setMoneyRequestAccountant(transactionID: string, accountant: Accountant, isDraft: boolean) { + Onyx.merge(`${isDraft ? ONYXKEYS.COLLECTION.TRANSACTION_DRAFT : ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, {accountant}); +} + +function setMoneyRequestPendingFields(transactionID: string, pendingFields: Transaction['pendingFields']) { + Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {pendingFields}); +} + +function setMoneyRequestTag(transactionID: string, tag: string) { + Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {tag}); +} + +function setMoneyRequestBillable(transactionID: string, billable: boolean) { + Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {billable}); +} + +function setMoneyRequestReimbursable(transactionID: string, reimbursable: boolean) { + Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {reimbursable}); +} + +function setMoneyRequestReportID(transactionID: string, reportID: string) { + Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {reportID}); +} + export { createTransaction, handleMoneyRequestStepScanParticipants, @@ -1343,5 +1424,21 @@ export { setCustomUnitID, setMoneyRequestDistance, setMoneyRequestDistanceRate, + setMoneyRequestReceiptState, + setMoneyRequestAmount, + clearMoneyRequestAmount, + clearMoneyRequestMerchant, + setMoneyRequestCreated, + setMoneyRequestDateAttribute, + setMoneyRequestCurrency, + setMoneyRequestDescription, + setMoneyRequestMerchant, + setMoneyRequestAttendees, + setMoneyRequestAccountant, + setMoneyRequestPendingFields, + setMoneyRequestTag, + setMoneyRequestBillable, + setMoneyRequestReimbursable, + setMoneyRequestReportID, }; export type {MoneyRequestStepScanParticipantsFlowParams}; diff --git a/src/libs/actions/IOU/index.ts b/src/libs/actions/IOU/index.ts index 2562f621a9c2..da66f26260c2 100644 --- a/src/libs/actions/IOU/index.ts +++ b/src/libs/actions/IOU/index.ts @@ -5,7 +5,7 @@ import type {UpdateMoneyRequestParams} from '@libs/API/parameters'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type * as OnyxTypes from '@src/types/onyx'; -import type {Accountant, Attendee, Participant} from '@src/types/onyx/IOU'; +import type {Attendee, Participant} from '@src/types/onyx/IOU'; import type RecentlyUsedTags from '@src/types/onyx/RecentlyUsedTags'; import type {OnyxData} from '@src/types/onyx/Request'; import type {Receipt} from '@src/types/onyx/Transaction'; @@ -264,102 +264,7 @@ function getMoneyRequestPolicyTags({ return getPolicyTagsData(iouReportPolicyID) ?? {}; } -function setMoneyRequestReceiptState(transactionID: string, isDraft: boolean, shouldStopSmartscan = false) { - if (!isDraft || !shouldStopSmartscan) { - return; - } - Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {receipt: {state: CONST.IOU.RECEIPT_STATE.OPEN}}); -} - -function setMoneyRequestAmount(transactionID: string, amount: number, currency: string, shouldShowOriginalAmount = false, shouldStopSmartscan = false) { - // Mark that the user has explicitly set the amount. This is used by the new manual expense flow to distinguish - // a default amount of 0 (field empty) from a user-entered 0 (valid $0 expense). - Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {amount, currency, shouldShowOriginalAmount, isAmountSet: true}); - setMoneyRequestReceiptState(transactionID, true, shouldStopSmartscan); -} - -/** - * Clears the amount field back to an empty/unset state in the new manual expense flow. - * Called when the user deletes all characters from the amount input so that the field - * shows as empty and submission is blocked until a value is entered again. - */ -function clearMoneyRequestAmount(transactionID: string) { - Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {amount: 0, isAmountSet: false}); -} - -function clearMoneyRequestMerchant(transactionID: string, isDraft = true) { - Onyx.merge(`${isDraft ? ONYXKEYS.COLLECTION.TRANSACTION_DRAFT : ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, {merchant: '', isMerchantSet: false}); -} - -function setMoneyRequestCreated(transactionID: string, created: string, isDraft: boolean, shouldStopSmartscan = false) { - Onyx.merge(`${isDraft ? ONYXKEYS.COLLECTION.TRANSACTION_DRAFT : ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, {created}); - setMoneyRequestReceiptState(transactionID, isDraft, shouldStopSmartscan); -} - -function setMoneyRequestDateAttribute(transactionID: string, start: string, end: string) { - Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {comment: {customUnit: {attributes: {dates: {start, end}}}}}); -} - -function setMoneyRequestCurrency(transactionID: string, currency: string, isEditing = false) { - const fieldToUpdate = isEditing ? 'modifiedCurrency' : 'currency'; - Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {[fieldToUpdate]: currency}); -} - -function setMoneyRequestDescription(transactionID: string, comment: string, isDraft: boolean, shouldStopSmartscan = false) { - // Trim only when persisting to the real transaction (not a draft) to avoid - // stripping trailing spaces/newlines while the user is still typing. - Onyx.merge(`${isDraft ? ONYXKEYS.COLLECTION.TRANSACTION_DRAFT : ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, {comment: {comment: isDraft ? comment : comment.trim()}}); - setMoneyRequestReceiptState(transactionID, isDraft, shouldStopSmartscan); -} - -function setMoneyRequestMerchant(transactionID: string, merchant: string, isDraft: boolean, shouldStopSmartscan = false) { - Onyx.merge(`${isDraft ? ONYXKEYS.COLLECTION.TRANSACTION_DRAFT : ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, {merchant, isMerchantSet: true}); - setMoneyRequestReceiptState(transactionID, isDraft, shouldStopSmartscan); -} -function setMoneyRequestAttendees(transactionID: string, attendees: Attendee[], isDraft: boolean) { - Onyx.merge(`${isDraft ? ONYXKEYS.COLLECTION.TRANSACTION_DRAFT : ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, {comment: {attendees}}); -} - -function setMoneyRequestAccountant(transactionID: string, accountant: Accountant, isDraft: boolean) { - Onyx.merge(`${isDraft ? ONYXKEYS.COLLECTION.TRANSACTION_DRAFT : ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, {accountant}); -} - -function setMoneyRequestPendingFields(transactionID: string, pendingFields: OnyxTypes.Transaction['pendingFields']) { - Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {pendingFields}); -} - -function setMoneyRequestTag(transactionID: string, tag: string) { - Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {tag}); -} - -function setMoneyRequestBillable(transactionID: string, billable: boolean) { - Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {billable}); -} - -function setMoneyRequestReimbursable(transactionID: string, reimbursable: boolean) { - Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {reimbursable}); -} - -function setMoneyRequestReportID(transactionID: string, reportID: string) { - Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {reportID}); -} - export { - setMoneyRequestAmount, - clearMoneyRequestAmount, - clearMoneyRequestMerchant, - setMoneyRequestAttendees, - setMoneyRequestAccountant, - setMoneyRequestBillable, - setMoneyRequestCreated, - setMoneyRequestDateAttribute, - setMoneyRequestCurrency, - setMoneyRequestDescription, - setMoneyRequestMerchant, - setMoneyRequestReportID, - setMoneyRequestPendingFields, - setMoneyRequestTag, - setMoneyRequestReimbursable, getAllPersonalDetails, getAllTransactions, getAllTransactionViolations, diff --git a/src/pages/Share/SubmitDetailsPage.tsx b/src/pages/Share/SubmitDetailsPage.tsx index fafb62341130..fbcd4919752b 100644 --- a/src/pages/Share/SubmitDetailsPage.tsx +++ b/src/pages/Share/SubmitDetailsPage.tsx @@ -22,12 +22,13 @@ import useReportIsArchived from '@hooks/useReportIsArchived'; import useReportOrReportDraft from '@hooks/useReportOrReportDraft'; import useThemeStyles from '@hooks/useThemeStyles'; import type {GpsPoint} from '@libs/actions/IOU'; -import {setMoneyRequestBillable, setMoneyRequestReimbursable} from '@libs/actions/IOU'; import { getIOURequestPolicyID, getMoneyRequestParticipantsFromReport, initMoneyRequest, + setMoneyRequestBillable, setMoneyRequestParticipantsFromReport, + setMoneyRequestReimbursable, updateLastLocationPermissionPrompt, } from '@libs/actions/IOU/MoneyRequest'; import {setMoneyRequestReceipt} from '@libs/actions/IOU/Receipt'; diff --git a/src/pages/iou/request/step/IOURequestStepAccountant.tsx b/src/pages/iou/request/step/IOURequestStepAccountant.tsx index 72adcb874332..b5cc69def42a 100644 --- a/src/pages/iou/request/step/IOURequestStepAccountant.tsx +++ b/src/pages/iou/request/step/IOURequestStepAccountant.tsx @@ -5,7 +5,7 @@ import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails' import useLastWorkspaceNumber from '@hooks/useLastWorkspaceNumber'; import useLocalize from '@hooks/useLocalize'; import useOnyx from '@hooks/useOnyx'; -import {setMoneyRequestAccountant} from '@libs/actions/IOU'; +import {setMoneyRequestAccountant} from '@libs/actions/IOU/MoneyRequest'; import {generateDefaultWorkspaceName} from '@libs/actions/Policy/Policy'; import Navigation from '@libs/Navigation/Navigation'; import {createDraftWorkspaceAndNavigateToConfirmationScreen} from '@libs/ReportUtils'; diff --git a/src/pages/iou/request/step/IOURequestStepAmount.tsx b/src/pages/iou/request/step/IOURequestStepAmount.tsx index 39a4e1a7295e..a42613fa2026 100644 --- a/src/pages/iou/request/step/IOURequestStepAmount.tsx +++ b/src/pages/iou/request/step/IOURequestStepAmount.tsx @@ -41,8 +41,13 @@ import {getPolicyExpenseChat, getTransactionDetails, isMoneyRequestReport, isPol import shouldUseDefaultExpensePolicy from '@libs/shouldUseDefaultExpensePolicy'; import {calculateTaxAmount, getAmount, getCurrency, getDefaultTaxCode, getRequestType, getTaxValue, hasReceipt, isDistanceRequest, isExpenseUnreported} from '@libs/TransactionUtils'; import MoneyRequestAmountForm from '@pages/iou/MoneyRequestAmountForm'; -import {setMoneyRequestAmount} from '@userActions/IOU'; -import {getMoneyRequestParticipantsFromReport, setMoneyRequestParticipantsFromReport, setMoneyRequestTaxAmount, setMoneyRequestTaxRate} from '@userActions/IOU/MoneyRequest'; +import { + getMoneyRequestParticipantsFromReport, + setMoneyRequestAmount, + setMoneyRequestParticipantsFromReport, + setMoneyRequestTaxAmount, + setMoneyRequestTaxRate, +} from '@userActions/IOU/MoneyRequest'; import {sendMoneyElsewhere, sendMoneyWithWallet} from '@userActions/IOU/SendMoney'; import {resetSplitShares, setDraftSplitTransaction, setSplitShares} from '@userActions/IOU/Split'; import {trackExpense} from '@userActions/IOU/TrackExpense'; diff --git a/src/pages/iou/request/step/IOURequestStepAttendees.tsx b/src/pages/iou/request/step/IOURequestStepAttendees.tsx index 2cca1d44e1c0..ec7b4e5415e7 100644 --- a/src/pages/iou/request/step/IOURequestStepAttendees.tsx +++ b/src/pages/iou/request/step/IOURequestStepAttendees.tsx @@ -7,7 +7,7 @@ import usePermissions from '@hooks/usePermissions'; import usePrevious from '@hooks/usePrevious'; import useRestartOnReceiptFailure from '@hooks/useRestartOnReceiptFailure'; import useTransactionViolations from '@hooks/useTransactionViolations'; -import {setMoneyRequestAttendees} from '@libs/actions/IOU'; +import {setMoneyRequestAttendees} from '@libs/actions/IOU/MoneyRequest'; import {updateMoneyRequestAttendees} from '@libs/actions/IOU/UpdateMoneyRequest'; import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID'; import Navigation from '@libs/Navigation/Navigation'; diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx index 2fc8b8d982ec..c1740de0c2a8 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx @@ -34,7 +34,7 @@ import useRestartOnOdometerImagesFailure from '@hooks/useRestartOnOdometerImages import useSelfDMReport from '@hooks/useSelfDMReport'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; -import {setMoneyRequestBillable, setMoneyRequestReimbursable} from '@libs/actions/IOU'; +import {setMoneyRequestBillable, setMoneyRequestReimbursable} from '@libs/actions/IOU/MoneyRequest'; import {isMobileSafari} from '@libs/Browser'; import {canUseTouchScreen} from '@libs/DeviceCapabilities'; import getIsNarrowLayout from '@libs/getIsNarrowLayout'; diff --git a/src/pages/iou/request/step/IOURequestStepDate.tsx b/src/pages/iou/request/step/IOURequestStepDate.tsx index a62e1fc8722a..0cdc9ce2f32a 100644 --- a/src/pages/iou/request/step/IOURequestStepDate.tsx +++ b/src/pages/iou/request/step/IOURequestStepDate.tsx @@ -19,7 +19,7 @@ import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID'; import {shouldUseTransactionDraft} from '@libs/IOUUtils'; import Navigation from '@libs/Navigation/Navigation'; import {getFormattedCreated, hasReceipt} from '@libs/TransactionUtils'; -import {setMoneyRequestCreated} from '@userActions/IOU'; +import {setMoneyRequestCreated} from '@userActions/IOU/MoneyRequest'; import {setDraftSplitTransaction} from '@userActions/IOU/Split'; import {updateMoneyRequestDate} from '@userActions/IOU/UpdateMoneyRequest'; import CONST from '@src/CONST'; diff --git a/src/pages/iou/request/step/IOURequestStepDescription.tsx b/src/pages/iou/request/step/IOURequestStepDescription.tsx index bd5432ad52d1..b90fe252ab2c 100644 --- a/src/pages/iou/request/step/IOURequestStepDescription.tsx +++ b/src/pages/iou/request/step/IOURequestStepDescription.tsx @@ -26,7 +26,7 @@ import Navigation from '@libs/Navigation/Navigation'; import Parser from '@libs/Parser'; import {hasReceipt} from '@libs/TransactionUtils'; import variables from '@styles/variables'; -import {setMoneyRequestDescription} from '@userActions/IOU'; +import {setMoneyRequestDescription} from '@userActions/IOU/MoneyRequest'; import {setDraftSplitTransaction} from '@userActions/IOU/Split'; import {updateMoneyRequestDescription} from '@userActions/IOU/UpdateMoneyRequest'; import CONST from '@src/CONST'; diff --git a/src/pages/iou/request/step/IOURequestStepDestination.tsx b/src/pages/iou/request/step/IOURequestStepDestination.tsx index a523486153ea..c4d768779a64 100644 --- a/src/pages/iou/request/step/IOURequestStepDestination.tsx +++ b/src/pages/iou/request/step/IOURequestStepDestination.tsx @@ -29,8 +29,14 @@ import {findSelfDMReportID, getPolicyExpenseChat} from '@libs/ReportUtils'; import {shouldRestrictUserBillableActions} from '@libs/SubscriptionUtils'; import type {SkeletonSpanReasonAttributes} from '@libs/telemetry/useSkeletonSpan'; import variables from '@styles/variables'; -import {setMoneyRequestCurrency} from '@userActions/IOU'; -import {getIOURequestPolicyID, setCustomUnitID, setCustomUnitRateID, setMoneyRequestCategory, setMoneyRequestParticipantsFromReport} from '@userActions/IOU/MoneyRequest'; +import { + getIOURequestPolicyID, + setCustomUnitID, + setCustomUnitRateID, + setMoneyRequestCategory, + setMoneyRequestCurrency, + setMoneyRequestParticipantsFromReport, +} from '@userActions/IOU/MoneyRequest'; import {clearSubrates} from '@userActions/IOU/PerDiem'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; diff --git a/src/pages/iou/request/step/IOURequestStepDistance/hooks/useDistanceRequestData.ts b/src/pages/iou/request/step/IOURequestStepDistance/hooks/useDistanceRequestData.ts index f724ab438090..b1fa0652d300 100644 --- a/src/pages/iou/request/step/IOURequestStepDistance/hooks/useDistanceRequestData.ts +++ b/src/pages/iou/request/step/IOURequestStepDistance/hooks/useDistanceRequestData.ts @@ -1,5 +1,5 @@ import type {OnyxEntry} from 'react-native-onyx'; -import {setMoneyRequestAmount} from '@libs/actions/IOU'; +import {setMoneyRequestAmount} from '@libs/actions/IOU/MoneyRequest'; import {setSplitShares} from '@libs/actions/IOU/Split'; import DistanceRequestUtils from '@libs/DistanceRequestUtils'; import type {MileageRate} from '@libs/DistanceRequestUtils'; diff --git a/src/pages/iou/request/step/IOURequestStepHours.tsx b/src/pages/iou/request/step/IOURequestStepHours.tsx index 035cb8d0be3c..efc88043187f 100644 --- a/src/pages/iou/request/step/IOURequestStepHours.tsx +++ b/src/pages/iou/request/step/IOURequestStepHours.tsx @@ -20,8 +20,7 @@ import {getPolicyExpenseChat} from '@libs/ReportUtils'; import {shouldRestrictUserBillableActions} from '@libs/SubscriptionUtils'; import {computeTimeAmount, formatTimeMerchant} from '@libs/TimeTrackingUtils'; import variables from '@styles/variables'; -import {setMoneyRequestAmount, setMoneyRequestMerchant} from '@userActions/IOU'; -import {setMoneyRequestParticipantsFromReport, setMoneyRequestTimeCount, setMoneyRequestTimeRate} from '@userActions/IOU/MoneyRequest'; +import {setMoneyRequestAmount, setMoneyRequestMerchant, setMoneyRequestParticipantsFromReport, setMoneyRequestTimeCount, setMoneyRequestTimeRate} from '@userActions/IOU/MoneyRequest'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; diff --git a/src/pages/iou/request/step/IOURequestStepMerchant.tsx b/src/pages/iou/request/step/IOURequestStepMerchant.tsx index beedbce677ac..6fb9b1e7eedd 100644 --- a/src/pages/iou/request/step/IOURequestStepMerchant.tsx +++ b/src/pages/iou/request/step/IOURequestStepMerchant.tsx @@ -20,7 +20,7 @@ import Navigation from '@libs/Navigation/Navigation'; import {getTransactionDetails, isExpenseRequest, isPolicyExpenseChat} from '@libs/ReportUtils'; import {hasReceipt} from '@libs/TransactionUtils'; import {isInvalidMerchantValue, isValidInputLength} from '@libs/ValidationUtils'; -import {setMoneyRequestMerchant} from '@userActions/IOU'; +import {setMoneyRequestMerchant} from '@userActions/IOU/MoneyRequest'; import {setDraftSplitTransaction} from '@userActions/IOU/Split'; import {updateMoneyRequestMerchant} from '@userActions/IOU/UpdateMoneyRequest'; import CONST from '@src/CONST'; diff --git a/src/pages/iou/request/step/IOURequestStepTag.tsx b/src/pages/iou/request/step/IOURequestStepTag.tsx index 939a44de53d4..cfd95e66e34b 100644 --- a/src/pages/iou/request/step/IOURequestStepTag.tsx +++ b/src/pages/iou/request/step/IOURequestStepTag.tsx @@ -14,7 +14,7 @@ import usePolicyForTransaction from '@hooks/usePolicyForTransaction'; import useRestartOnReceiptFailure from '@hooks/useRestartOnReceiptFailure'; import useShowNotFoundPageInIOUStep from '@hooks/useShowNotFoundPageInIOUStep'; import useThemeStyles from '@hooks/useThemeStyles'; -import {setMoneyRequestTag} from '@libs/actions/IOU'; +import {setMoneyRequestTag} from '@libs/actions/IOU/MoneyRequest'; import {setDraftSplitTransaction} from '@libs/actions/IOU/Split'; import {updateMoneyRequestTag} from '@libs/actions/IOU/UpdateMoneyRequest'; import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID'; diff --git a/src/pages/iou/request/step/IOURequestStepTaxAmountPage.tsx b/src/pages/iou/request/step/IOURequestStepTaxAmountPage.tsx index f4a04f5fa5a8..5e8521828f2f 100644 --- a/src/pages/iou/request/step/IOURequestStepTaxAmountPage.tsx +++ b/src/pages/iou/request/step/IOURequestStepTaxAmountPage.tsx @@ -8,8 +8,7 @@ import useOnyx from '@hooks/useOnyx'; import usePermissions from '@hooks/usePermissions'; import usePolicyForTransaction from '@hooks/usePolicyForTransaction'; import useRestartOnReceiptFailure from '@hooks/useRestartOnReceiptFailure'; -import {setMoneyRequestCurrency} from '@libs/actions/IOU'; -import {setMoneyRequestParticipantsFromReport, setMoneyRequestTaxAmount} from '@libs/actions/IOU/MoneyRequest'; +import {setMoneyRequestCurrency, setMoneyRequestParticipantsFromReport, setMoneyRequestTaxAmount} from '@libs/actions/IOU/MoneyRequest'; import {setDraftSplitTransaction} from '@libs/actions/IOU/Split'; import {updateMoneyRequestTaxAmount} from '@libs/actions/IOU/UpdateMoneyRequest'; import {convertToBackendAmount, getCurrencyDecimals} from '@libs/CurrencyUtils'; diff --git a/src/pages/iou/request/step/IOURequestStepTime.tsx b/src/pages/iou/request/step/IOURequestStepTime.tsx index 97853dbc03b9..7403172d99f0 100644 --- a/src/pages/iou/request/step/IOURequestStepTime.tsx +++ b/src/pages/iou/request/step/IOURequestStepTime.tsx @@ -18,8 +18,7 @@ import {isValidMoneyRequestType} from '@libs/IOUUtils'; import Navigation from '@libs/Navigation/Navigation'; import {getActivePoliciesWithExpenseChatAndPerDiemEnabledAndHasRates} from '@libs/PolicyUtils'; import type {SkeletonSpanReasonAttributes} from '@libs/telemetry/useSkeletonSpan'; -import {setMoneyRequestDateAttribute} from '@userActions/IOU'; -import {getIOURequestPolicyID} from '@userActions/IOU/MoneyRequest'; +import {getIOURequestPolicyID, setMoneyRequestDateAttribute} from '@userActions/IOU/MoneyRequest'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; diff --git a/src/pages/iou/request/step/IOURequestStepTimeRate.tsx b/src/pages/iou/request/step/IOURequestStepTimeRate.tsx index 48c43169ddc4..0729232fd973 100644 --- a/src/pages/iou/request/step/IOURequestStepTimeRate.tsx +++ b/src/pages/iou/request/step/IOURequestStepTimeRate.tsx @@ -6,8 +6,7 @@ import {useCurrencyListActions} from '@hooks/useCurrencyList'; import useLocalize from '@hooks/useLocalize'; import useRestartOnReceiptFailure from '@hooks/useRestartOnReceiptFailure'; import useShowNotFoundPageInIOUStep from '@hooks/useShowNotFoundPageInIOUStep'; -import {setMoneyRequestAmount, setMoneyRequestMerchant} from '@libs/actions/IOU'; -import {setMoneyRequestTimeRate} from '@libs/actions/IOU/MoneyRequest'; +import {setMoneyRequestAmount, setMoneyRequestMerchant, setMoneyRequestTimeRate} from '@libs/actions/IOU/MoneyRequest'; import {convertToBackendAmount} from '@libs/CurrencyUtils'; import {shouldUseTransactionDraft} from '@libs/IOUUtils'; import Navigation from '@libs/Navigation/Navigation'; diff --git a/src/pages/iou/request/step/confirmation/ExpenseDefaultsSetter.tsx b/src/pages/iou/request/step/confirmation/ExpenseDefaultsSetter.tsx index 1e3d5557279e..681da6bd0192 100644 --- a/src/pages/iou/request/step/confirmation/ExpenseDefaultsSetter.tsx +++ b/src/pages/iou/request/step/confirmation/ExpenseDefaultsSetter.tsx @@ -1,7 +1,7 @@ import {useEffect} from 'react'; import type {OnyxEntry} from 'react-native-onyx'; import {isPaidGroupPolicy} from '@libs/PolicyUtils'; -import {setMoneyRequestBillable, setMoneyRequestReimbursable} from '@userActions/IOU'; +import {setMoneyRequestBillable, setMoneyRequestReimbursable} from '@userActions/IOU/MoneyRequest'; import type {Policy} from '@src/types/onyx'; type ExpenseDefaultsSetterProps = { diff --git a/tests/actions/IOU/IOUSettersTest.ts b/tests/actions/IOU/IOUSettersTest.ts index bf47faefcafb..e3dbb864be75 100644 --- a/tests/actions/IOU/IOUSettersTest.ts +++ b/tests/actions/IOU/IOUSettersTest.ts @@ -8,8 +8,9 @@ import { setMoneyRequestMerchant, setMoneyRequestReimbursable, setMoneyRequestTag, -} from '@libs/actions/IOU'; -import {setMoneyRequestTaxAmount, setMoneyRequestTaxRate} from '@libs/actions/IOU/MoneyRequest'; + setMoneyRequestTaxAmount, + setMoneyRequestTaxRate, +} from '@libs/actions/IOU/MoneyRequest'; import ONYXKEYS from '@src/ONYXKEYS'; import createRandomTransaction from '../../utils/collections/transaction'; import getOnyxValue from '../../utils/getOnyxValue'; diff --git a/tests/actions/IOUTest.ts b/tests/actions/IOUTest.ts index 37750242d8be..177197afb816 100644 --- a/tests/actions/IOUTest.ts +++ b/tests/actions/IOUTest.ts @@ -7,9 +7,19 @@ import type {OnyxCollection, OnyxEntry, OnyxMergeCollectionInput} from 'react-na import type {SearchQueryJSON, SearchStatus} from '@components/Search/types'; import useOnyx from '@hooks/useOnyx'; import {clearAllRelatedReportActionErrors} from '@libs/actions/ClearReportActionErrors'; -import {setMoneyRequestAmount, setMoneyRequestBillable, setMoneyRequestCreated, setMoneyRequestDateAttribute, setMoneyRequestMerchant, setMoneyRequestTag} from '@libs/actions/IOU'; import {putOnHold} from '@libs/actions/IOU/Hold'; -import {initMoneyRequest, resetDraftTransactionsCustomUnit, setMoneyRequestCategory, setMoneyRequestDistanceRate} from '@libs/actions/IOU/MoneyRequest'; +import { + initMoneyRequest, + resetDraftTransactionsCustomUnit, + setMoneyRequestAmount, + setMoneyRequestBillable, + setMoneyRequestCategory, + setMoneyRequestCreated, + setMoneyRequestDateAttribute, + setMoneyRequestDistanceRate, + setMoneyRequestMerchant, + setMoneyRequestTag, +} from '@libs/actions/IOU/MoneyRequest'; import {calculateDiffAmount} from '@libs/actions/IOU/MoneyRequestBuilder'; import {handleNavigateAfterExpenseCreate} from '@libs/actions/IOU/NavigationHelpers'; import {shouldOptimisticallyUpdateSearch} from '@libs/actions/IOU/SearchUpdate'; diff --git a/tests/ui/IOURequestStepHoursTest.tsx b/tests/ui/IOURequestStepHoursTest.tsx index e17aa8a453b7..df2e7f0d9c94 100644 --- a/tests/ui/IOURequestStepHoursTest.tsx +++ b/tests/ui/IOURequestStepHoursTest.tsx @@ -84,8 +84,8 @@ describe('IOURequestStepHours', () => { jest.clearAllMocks(); await signInWithTestUser(ACCOUNT_ID, ACCOUNT_LOGIN); - setMoneyRequestAmountSpy = jest.spyOn(require('@libs/actions/IOU'), 'setMoneyRequestAmount'); - setMoneyRequestMerchantSpy = jest.spyOn(require('@libs/actions/IOU'), 'setMoneyRequestMerchant'); + setMoneyRequestAmountSpy = jest.spyOn(require('@libs/actions/IOU/MoneyRequest'), 'setMoneyRequestAmount'); + setMoneyRequestMerchantSpy = jest.spyOn(require('@libs/actions/IOU/MoneyRequest'), 'setMoneyRequestMerchant'); setMoneyRequestTimeCountSpy = jest.spyOn(require('@libs/actions/IOU/MoneyRequest'), 'setMoneyRequestTimeCount'); setMoneyRequestTimeRateSpy = jest.spyOn(require('@libs/actions/IOU/MoneyRequest'), 'setMoneyRequestTimeRate'); diff --git a/tests/ui/IOURequestStepTimeRateTest.tsx b/tests/ui/IOURequestStepTimeRateTest.tsx index 4f495e9c7cbb..67b0c5ebcd0d 100644 --- a/tests/ui/IOURequestStepTimeRateTest.tsx +++ b/tests/ui/IOURequestStepTimeRateTest.tsx @@ -75,8 +75,8 @@ describe('IOURequestStepTimeRate', () => { jest.clearAllMocks(); await signInWithTestUser(ACCOUNT_ID, ACCOUNT_LOGIN); - setMoneyRequestAmountSpy = jest.spyOn(require('@libs/actions/IOU'), 'setMoneyRequestAmount'); - setMoneyRequestMerchantSpy = jest.spyOn(require('@libs/actions/IOU'), 'setMoneyRequestMerchant'); + setMoneyRequestAmountSpy = jest.spyOn(require('@libs/actions/IOU/MoneyRequest'), 'setMoneyRequestAmount'); + setMoneyRequestMerchantSpy = jest.spyOn(require('@libs/actions/IOU/MoneyRequest'), 'setMoneyRequestMerchant'); setMoneyRequestTimeRateSpy = jest.spyOn(require('@libs/actions/IOU/MoneyRequest'), 'setMoneyRequestTimeRate'); });