diff --git a/src/components/AddExistingExpenseFooter.tsx b/src/components/AddExistingExpenseFooter.tsx index 10a7297f23d0..5767bb0976d4 100644 --- a/src/components/AddExistingExpenseFooter.tsx +++ b/src/components/AddExistingExpenseFooter.tsx @@ -51,7 +51,7 @@ function AddExistingExpenseFooter({selectedIds, report, reportToConfirm, policy, const styles = useThemeStyles(); const {isBetaEnabled} = usePermissions(); const isASAPSubmitBetaEnabled = isBetaEnabled(CONST.BETAS.ASAP_SUBMIT); - const {getCurrencyDecimals} = useCurrencyListActions(); + const {getCurrencyDecimals, getCurrencySymbol} = useCurrencyListActions(); const session = useSession(); const personalDetails = usePersonalDetails(); const delegateAccountID = useDelegateAccountID(); @@ -116,6 +116,7 @@ function AddExistingExpenseFooter({selectedIds, report, reportToConfirm, policy, selfDMReportActions, delegateAccountID, getCurrencyDecimals, + getCurrencySymbol, }); } }, diff --git a/src/hooks/useUndeleteTransactions.ts b/src/hooks/useUndeleteTransactions.ts index f56a2d5628ec..e5af0ef61a7a 100644 --- a/src/hooks/useUndeleteTransactions.ts +++ b/src/hooks/useUndeleteTransactions.ts @@ -16,7 +16,7 @@ import usePermissions from './usePermissions'; function useUndeleteTransactions() { const currentUserPersonalDetails = useCurrentUserPersonalDetails(); const delegateAccountID = useDelegateAccountID(); - const {getCurrencyDecimals} = useCurrencyListActions(); + const {getCurrencyDecimals, getCurrencySymbol} = useCurrencyListActions(); const {isBetaEnabled} = usePermissions(); const isASAPSubmitBetaEnabled = isBetaEnabled(CONST.BETAS.ASAP_SUBMIT); const [personalPolicyID] = useOnyx(ONYXKEYS.PERSONAL_POLICY_ID); @@ -46,6 +46,7 @@ function useUndeleteTransactions() { personalPolicyOutputCurrency: policy?.outputCurrency, delegateAccountID, getCurrencyDecimals, + getCurrencySymbol, }); }; } diff --git a/src/libs/CurrencyUtils.ts b/src/libs/CurrencyUtils.ts index 0ca8b71af063..63bb2abf3065 100644 --- a/src/libs/CurrencyUtils.ts +++ b/src/libs/CurrencyUtils.ts @@ -295,7 +295,6 @@ export { resetInvalidCurrencyWarningsForTesting, getCurrencyDecimals, getLocalizedCurrencySymbol, - getCurrencySymbol, convertToBackendAmount, convertToFrontendAmountAsInteger, convertToFrontendAmountAsString, diff --git a/src/libs/actions/Report/index.ts b/src/libs/actions/Report/index.ts index 999b1dd3d6b1..96880f0eba6c 100644 --- a/src/libs/actions/Report/index.ts +++ b/src/libs/actions/Report/index.ts @@ -472,6 +472,7 @@ type MergeReportsProps = { selfDMReportActions: OnyxEntry; delegateAccountID: number | undefined; getCurrencyDecimals: CurrencyListActionsContextType['getCurrencyDecimals']; + getCurrencySymbol: CurrencyListActionsContextType['getCurrencySymbol']; }; const addNewMessageWithText = new Set([WRITE_COMMANDS.ADD_COMMENT, WRITE_COMMANDS.ADD_TEXT_AND_ATTACHMENT]); @@ -8451,6 +8452,7 @@ function mergeReports({ selfDMReportActions, delegateAccountID, getCurrencyDecimals, + getCurrencySymbol, }: MergeReportsProps) { const reports = allReportsParam ?? allReports; const destinationReport = reports?.[`${ONYXKEYS.COLLECTION.REPORT}${destinationReportID}`]; @@ -8481,6 +8483,7 @@ function mergeReports({ selfDMReportActions, delegateAccountID, getCurrencyDecimals, + getCurrencySymbol, }); const { diff --git a/src/libs/actions/Transaction.ts b/src/libs/actions/Transaction.ts index 085a12a4140d..80f4b596e98e 100644 --- a/src/libs/actions/Transaction.ts +++ b/src/libs/actions/Transaction.ts @@ -10,7 +10,6 @@ import type { TransactionThreadInfo, } from '@libs/API/parameters'; import {READ_COMMANDS, WRITE_COMMANDS} from '@libs/API/types'; -import {getCurrencySymbol} from '@libs/CurrencyUtils'; import DateUtils from '@libs/DateUtils'; import DistanceRequestUtils from '@libs/DistanceRequestUtils'; import {toLocaleDigit} from '@libs/LocaleDigitUtils'; @@ -860,6 +859,7 @@ type ChangeTransactionsReportProps = { selfDMReportActions: OnyxEntry; delegateAccountID: number | undefined; getCurrencyDecimals: CurrencyListActionsContextType['getCurrencyDecimals']; + getCurrencySymbol: CurrencyListActionsContextType['getCurrencySymbol']; }; function getChangeTransactionsReportOnyxData({ @@ -880,6 +880,7 @@ function getChangeTransactionsReportOnyxData({ selfDMReportActions, delegateAccountID, getCurrencyDecimals, + getCurrencySymbol, }: ChangeTransactionsReportProps) { const reportID = newReport?.reportID ?? CONST.REPORT.UNREPORTED_REPORT_ID; diff --git a/src/pages/DynamicNewReportWorkspaceSelectionPage.tsx b/src/pages/DynamicNewReportWorkspaceSelectionPage.tsx index e6a735273037..08391006a7a1 100644 --- a/src/pages/DynamicNewReportWorkspaceSelectionPage.tsx +++ b/src/pages/DynamicNewReportWorkspaceSelectionPage.tsx @@ -90,7 +90,7 @@ function DynamicNewReportWorkspaceSelectionPage({route}: NewReportWorkspaceSelec const currentUserPersonalDetails = useCurrentUserPersonalDetails(); const delegateAccountID = useDelegateAccountID(); const personalPolicy = usePersonalPolicy(); - const {getCurrencyDecimals} = useCurrencyListActions(); + const {getCurrencyDecimals, getCurrencySymbol} = useCurrencyListActions(); const selectedTransactionsKeys = Object.keys(selectedTransactions); const transactionIDs = selectedTransactionsKeys.length ? selectedTransactionsKeys : selectedTransactionIDs; @@ -151,6 +151,7 @@ function DynamicNewReportWorkspaceSelectionPage({route}: NewReportWorkspaceSelec selfDMReportActions, delegateAccountID, getCurrencyDecimals, + getCurrencySymbol, }); // eslint-disable-next-line rulesdir/no-default-id-values diff --git a/src/pages/Search/SearchTransactionsChangeReport.tsx b/src/pages/Search/SearchTransactionsChangeReport.tsx index 88ff61bff4ea..83484a518d6e 100644 --- a/src/pages/Search/SearchTransactionsChangeReport.tsx +++ b/src/pages/Search/SearchTransactionsChangeReport.tsx @@ -70,7 +70,7 @@ function SearchTransactionsChangeReport() { const isASAPSubmitBetaEnabled = isBetaEnabled(CONST.BETAS.ASAP_SUBMIT); const session = useSession(); const personalDetails = usePersonalDetails(); - const {getCurrencyDecimals} = useCurrencyListActions(); + const {getCurrencyDecimals, getCurrencySymbol} = useCurrencyListActions(); const hasViolations = hasViolationsReportUtils(undefined, transactionViolations, session?.accountID ?? CONST.DEFAULT_NUMBER_ID, session?.email ?? ''); const firstTransactionKey = selectedTransactionsKeys.at(0); const firstTransactionReportID = firstTransactionKey ? selectedTransactions[firstTransactionKey]?.reportID : undefined; @@ -189,6 +189,7 @@ function SearchTransactionsChangeReport() { selfDMReportActions, delegateAccountID, getCurrencyDecimals, + getCurrencySymbol, }); clearSelectedTransactions(); }); @@ -280,6 +281,7 @@ function SearchTransactionsChangeReport() { selfDMReportActions, delegateAccountID, getCurrencyDecimals, + getCurrencySymbol, }); Navigation.goBack(undefined, {afterTransition: clearSelectedTransactions}); }; @@ -304,6 +306,7 @@ function SearchTransactionsChangeReport() { selfDMReportActions, delegateAccountID, getCurrencyDecimals, + getCurrencySymbol, }); clearSelectedTransactions(); Navigation.goBack(); diff --git a/src/pages/iou/request/step/DynamicIOURequestEditReport.tsx b/src/pages/iou/request/step/DynamicIOURequestEditReport.tsx index 918f17e0cd22..e939d13baeec 100644 --- a/src/pages/iou/request/step/DynamicIOURequestEditReport.tsx +++ b/src/pages/iou/request/step/DynamicIOURequestEditReport.tsx @@ -96,7 +96,7 @@ function DynamicIOURequestEditReport({route}: DynamicIOURequestEditReportProps) const [selfDMReportID] = useOnyx(ONYXKEYS.SELF_DM_REPORT_ID); const [selfDMReportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${getNonEmptyStringOnyxID(selfDMReportID)}`); const [isTrackIntentUser] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED, {selector: isTrackIntentUserSelector}); - const {getCurrencyDecimals} = useCurrencyListActions(); + const {getCurrencyDecimals, getCurrencySymbol} = useCurrencyListActions(); const selectReport = (item: TransactionGroupListItem, report?: OnyxEntry) => { if (transactionIDs.length === 0 || item.value === reportID) { Navigation.dismissToSuperWideRHP(); @@ -125,6 +125,7 @@ function DynamicIOURequestEditReport({route}: DynamicIOURequestEditReportProps) selfDMReportActions, delegateAccountID, getCurrencyDecimals, + getCurrencySymbol, }); turnOffMobileSelectionMode(); clearSelectedTransactions(true); @@ -153,6 +154,7 @@ function DynamicIOURequestEditReport({route}: DynamicIOURequestEditReportProps) selfDMReportActions, delegateAccountID, getCurrencyDecimals, + getCurrencySymbol, }); if (shouldTurnOffSelectionMode) { turnOffMobileSelectionMode(); diff --git a/src/pages/iou/request/step/DynamicIOURequestStepUpgrade.tsx b/src/pages/iou/request/step/DynamicIOURequestStepUpgrade.tsx index a812bd731e96..3fa8db5966fe 100644 --- a/src/pages/iou/request/step/DynamicIOURequestStepUpgrade.tsx +++ b/src/pages/iou/request/step/DynamicIOURequestStepUpgrade.tsx @@ -107,7 +107,7 @@ function DynamicIOURequestStepUpgrade({ const [selfDMReportID] = useOnyx(ONYXKEYS.SELF_DM_REPORT_ID); const [selfDMReportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${getNonEmptyStringOnyxID(selfDMReportID)}`); const isTrackIntentUser = isTrackOnboardingChoice(introSelected?.choice); - const {getCurrencyDecimals} = useCurrencyListActions(); + const {getCurrencyDecimals, getCurrencySymbol} = useCurrencyListActions(); // Search-selected transactions are not in COLLECTION.TRANSACTION — extract from `selectedTransactions` directly. const transactions = Object.values(selectedTransactions) @@ -169,6 +169,7 @@ function DynamicIOURequestStepUpgrade({ personalPolicyOutputCurrency: undefined, delegateAccountID, getCurrencyDecimals, + getCurrencySymbol, }); clearSelectedTransactions(); @@ -279,6 +280,7 @@ function DynamicIOURequestStepUpgrade({ isTrackIntentUser, delegateAccountID, getCurrencyDecimals, + getCurrencySymbol, ]); const participant = transaction?.participants?.[0]; diff --git a/src/pages/iou/request/step/IOURequestStepReport/hooks/useReportSelectionActions.ts b/src/pages/iou/request/step/IOURequestStepReport/hooks/useReportSelectionActions.ts index 506ae90aa7fc..58ed0eec7585 100644 --- a/src/pages/iou/request/step/IOURequestStepReport/hooks/useReportSelectionActions.ts +++ b/src/pages/iou/request/step/IOURequestStepReport/hooks/useReportSelectionActions.ts @@ -120,7 +120,7 @@ function useReportSelectionActions({ const reports = useChangeTransactionsReportReports(transaction ? [transaction] : [], undefined); const [isTrackIntentUser] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED, {selector: isTrackIntentUserSelector}); const delegateAccountID = useDelegateAccountID(); - const {getCurrencyDecimals} = useCurrencyListActions(); + const {getCurrencyDecimals, getCurrencySymbol} = useCurrencyListActions(); const targetTransactionIDs = transaction?.transactionID ? [transaction.transactionID] : []; const targetTransactions = transaction ? [transaction] : []; @@ -227,6 +227,7 @@ function useReportSelectionActions({ selfDMReportActions, delegateAccountID, getCurrencyDecimals, + getCurrencySymbol, }); removeTransaction(transaction.transactionID); } @@ -256,6 +257,7 @@ function useReportSelectionActions({ selfDMReportActions, delegateAccountID, getCurrencyDecimals, + getCurrencySymbol, }); removeTransaction(transaction.transactionID); }, diff --git a/tests/actions/IOU/MoneyRequestSettersTest.ts b/tests/actions/IOU/MoneyRequestSettersTest.ts index 1bc0b44088ec..4ccf51d37653 100644 --- a/tests/actions/IOU/MoneyRequestSettersTest.ts +++ b/tests/actions/IOU/MoneyRequestSettersTest.ts @@ -11,7 +11,6 @@ import { setMoneyRequestTag, } from '@libs/actions/IOU/MoneyRequest'; import initOnyxDerivedValues from '@libs/actions/OnyxDerived'; -import {getCurrencyDecimals} from '@libs/CurrencyUtils'; import Log from '@libs/Log'; import type * as PolicyUtils from '@libs/PolicyUtils'; @@ -34,7 +33,7 @@ import createRandomPolicy, {createCategoryTaxExpenseRules} from '../../utils/col import {createRandomReport} from '../../utils/collections/reports'; import createRandomTransaction from '../../utils/collections/transaction'; import getOnyxValue from '../../utils/getOnyxValue'; -import {getGlobalFetchMock} from '../../utils/TestHelper'; +import {getCurrencyDecimalsLocal, getGlobalFetchMock} from '../../utils/TestHelper'; import waitForBatchedUpdates from '../../utils/waitForBatchedUpdates'; const topMostReportID = '23423423'; @@ -357,7 +356,7 @@ describe('actions/IOU', () => { await Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, fakePolicy); // When setting the money request category - setMoneyRequestCategory(transactionID, category, fakePolicy, getCurrencyDecimals); + setMoneyRequestCategory(transactionID, category, fakePolicy, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); @@ -398,7 +397,7 @@ describe('actions/IOU', () => { await Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, fakePolicy); // When setting the money request category - setMoneyRequestCategory(transactionID, category, fakePolicy, getCurrencyDecimals); + setMoneyRequestCategory(transactionID, category, fakePolicy, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); @@ -436,7 +435,7 @@ describe('actions/IOU', () => { await Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, fakePolicy); // When setting the money request category - setMoneyRequestCategory(transactionID, category, fakePolicy, getCurrencyDecimals); + setMoneyRequestCategory(transactionID, category, fakePolicy, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); @@ -467,7 +466,7 @@ describe('actions/IOU', () => { }); // When setting the money request category without a policyID - setMoneyRequestCategory(transactionID, '', undefined, getCurrencyDecimals); + setMoneyRequestCategory(transactionID, '', undefined, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); // Then the transaction tax should be cleared diff --git a/tests/actions/IOU/MoneyRequestTest.ts b/tests/actions/IOU/MoneyRequestTest.ts index 6fea13f2c48c..acacbe92d581 100644 --- a/tests/actions/IOU/MoneyRequestTest.ts +++ b/tests/actions/IOU/MoneyRequestTest.ts @@ -1,5 +1,4 @@ import {createTransaction, getMoneyRequestParticipantOptions, setMoneyRequestCommuterExclusionFields} from '@libs/actions/IOU/MoneyRequest'; -import {getCurrencySymbol} from '@libs/CurrencyUtils'; import createDynamicRoute from '@libs/Navigation/helpers/dynamicRoutesUtils/createDynamicRoute'; import Navigation from '@libs/Navigation/Navigation'; import {getPolicyExpenseChat} from '@libs/ReportUtils'; @@ -30,7 +29,7 @@ import createRandomPolicy from '../../utils/collections/policies'; import {createRandomReport, createSelfDM} from '../../utils/collections/reports'; import createRandomTransaction from '../../utils/collections/transaction'; import getOnyxValue from '../../utils/getOnyxValue'; -import {formatPhoneNumber, getCurrencyDecimalsLocal, translateLocal} from '../../utils/TestHelper'; +import {formatPhoneNumber, getCurrencyDecimalsLocal, getCurrencySymbolLocal, translateLocal} from '../../utils/TestHelper'; import waitForBatchedUpdates from '../../utils/waitForBatchedUpdates'; jest.mock('@libs/actions/IOU', () => { @@ -834,7 +833,7 @@ describe('MoneyRequest', () => { backTo, draftTransactionIDs: [baseParams.transactionID], delegateAccountID: undefined, - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(Navigation.goBack).toHaveBeenCalledWith(backTo); @@ -847,7 +846,7 @@ describe('MoneyRequest', () => { backTo, draftTransactionIDs: undefined, delegateAccountID: undefined, - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(Navigation.goBack).toHaveBeenCalledWith(backTo); @@ -868,7 +867,7 @@ describe('MoneyRequest', () => { iouType: CONST.IOU.TYPE.TRACK, draftTransactionIDs: [baseParams.transactionID], delegateAccountID: undefined, - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(Split.resetSplitShares).toHaveBeenCalledWith(splitTransaction, undefined, undefined, 1, getCurrencyDecimalsLocal); @@ -885,7 +884,7 @@ describe('MoneyRequest', () => { iouType: CONST.IOU.TYPE.TRACK, draftTransactionIDs: [baseParams.transactionID], delegateAccountID: undefined, - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(TrackExpense.trackExpense).toHaveBeenCalledWith(expect.objectContaining({conciergeChat})); @@ -900,7 +899,7 @@ describe('MoneyRequest', () => { iouType: CONST.IOU.TYPE.TRACK, draftTransactionIDs: [baseParams.transactionID], delegateAccountID: undefined, - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(Split.resetSplitShares).not.toHaveBeenCalled(); @@ -950,7 +949,7 @@ describe('MoneyRequest', () => { iouType: CONST.IOU.TYPE.SUBMIT, draftTransactionIDs: [baseParams.transactionID], delegateAccountID: undefined, - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, }); const transactionParams = jest.mocked(Split.createDistanceRequest).mock.calls.at(-1)?.at(0)?.transactionParams; @@ -989,7 +988,7 @@ describe('MoneyRequest', () => { optimisticTransactionID: 'optimistic-should-be-ignored', draftTransactionIDs: [baseParams.transactionID], delegateAccountID: undefined, - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, }); await waitForBatchedUpdates(); @@ -1013,7 +1012,7 @@ describe('MoneyRequest', () => { optimisticTransactionID: 'optimistic-should-be-ignored', draftTransactionIDs: [baseParams.transactionID], delegateAccountID: undefined, - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, }); await waitForBatchedUpdates(); @@ -1073,7 +1072,7 @@ describe('MoneyRequest', () => { } as OptionData, ], delegateAccountID: undefined, - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, }); await waitForBatchedUpdates(); @@ -1141,7 +1140,7 @@ describe('MoneyRequest', () => { iouType: CONST.IOU.TYPE.SUBMIT, draftTransactionIDs: [baseParams.transactionID], delegateAccountID: undefined, - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(Split.createDistanceRequest).toHaveBeenCalledWith( @@ -1186,7 +1185,7 @@ describe('MoneyRequest', () => { iouType: CONST.IOU.TYPE.SUBMIT, draftTransactionIDs: [baseParams.transactionID], delegateAccountID: undefined, - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(Split.createDistanceRequest).toHaveBeenCalledWith( @@ -1230,7 +1229,7 @@ describe('MoneyRequest', () => { iouType: CONST.IOU.TYPE.SUBMIT, draftTransactionIDs: [baseParams.transactionID], delegateAccountID: undefined, - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, }); await waitForBatchedUpdates(); @@ -1273,7 +1272,7 @@ describe('MoneyRequest', () => { iouType: CONST.IOU.TYPE.CREATE, draftTransactionIDs: [baseParams.transactionID], delegateAccountID: undefined, - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, }); await waitForBatchedUpdates(); @@ -1317,7 +1316,7 @@ describe('MoneyRequest', () => { iouType: CONST.IOU.TYPE.CREATE, draftTransactionIDs: [baseParams.transactionID], delegateAccountID: undefined, - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, }); await waitForBatchedUpdates(); @@ -1332,7 +1331,7 @@ describe('MoneyRequest', () => { iouType: CONST.IOU.TYPE.CREATE, draftTransactionIDs: [baseParams.transactionID], delegateAccountID: undefined, - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(Navigation.navigate).toHaveBeenCalledWith( @@ -1357,7 +1356,7 @@ describe('MoneyRequest', () => { iouType: CONST.IOU.TYPE.CREATE, amountOwed: 8010, delegateAccountID: undefined, - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(Navigation.navigate).toHaveBeenCalledWith( @@ -1384,7 +1383,7 @@ describe('MoneyRequest', () => { amountOwed: 100, ownerBillingGracePeriodEnd: pastDate, delegateAccountID: undefined, - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(Navigation.navigate).toHaveBeenCalledWith( @@ -1408,7 +1407,7 @@ describe('MoneyRequest', () => { defaultExpensePolicy: fakePolicy, iouType: CONST.IOU.TYPE.CREATE, delegateAccountID: undefined, - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, }); const lastCallArgs = jest.mocked(shouldUseDefaultExpensePolicy).mock.calls.at(-1) ?? []; @@ -1424,7 +1423,7 @@ describe('MoneyRequest', () => { isArchivedExpenseReport: false, draftTransactionIDs: [baseParams.transactionID], delegateAccountID: undefined, - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, }); await waitForBatchedUpdates(); @@ -1446,7 +1445,7 @@ describe('MoneyRequest', () => { capturedParticipants = participants; }, delegateAccountID: undefined, - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, }); await waitForBatchedUpdates(); @@ -1469,7 +1468,7 @@ describe('MoneyRequest', () => { capturedParticipants = participants; }, delegateAccountID: undefined, - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, }); await waitForBatchedUpdates(); @@ -1492,7 +1491,7 @@ describe('MoneyRequest', () => { shouldSkipConfirmation: true, iouType: CONST.IOU.TYPE.TRACK, draftTransactionIDs: [baseParams.transactionID], - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(Split.resetSplitShares).not.toHaveBeenCalled(); @@ -1509,7 +1508,7 @@ describe('MoneyRequest', () => { shouldSkipConfirmation: true, iouType: CONST.IOU.TYPE.TRACK, draftTransactionIDs: [baseParams.transactionID], - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(TrackExpense.trackExpense).toHaveBeenCalledWith( @@ -1535,7 +1534,7 @@ describe('MoneyRequest', () => { shouldSkipConfirmation: true, iouType: CONST.IOU.TYPE.TRACK, draftTransactionIDs: [baseParams.transactionID], - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(TrackExpense.trackExpense).toHaveBeenCalledWith( @@ -1559,7 +1558,7 @@ describe('MoneyRequest', () => { shouldSkipConfirmation: true, iouType: CONST.IOU.TYPE.SUBMIT, draftTransactionIDs: [baseParams.transactionID], - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(Split.createDistanceRequest).toHaveBeenCalledWith( @@ -1582,7 +1581,7 @@ describe('MoneyRequest', () => { defaultExpensePolicy: undefined, iouType: CONST.IOU.TYPE.SUBMIT, draftTransactionIDs: [baseParams.transactionID], - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(Navigation.navigate).toHaveBeenCalledWith( @@ -1654,7 +1653,7 @@ describe('MoneyRequest', () => { distanceUnit: CONST.CUSTOM_UNITS.DISTANCE_UNIT_MILES, translate: translateLocal, toLocaleDigit: (digit: string) => digit, - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, }; afterEach(async () => { diff --git a/tests/actions/IOUTest/BulkEditTest.ts b/tests/actions/IOUTest/BulkEditTest.ts index b252c3eea8ab..334930d51837 100644 --- a/tests/actions/IOUTest/BulkEditTest.ts +++ b/tests/actions/IOUTest/BulkEditTest.ts @@ -1,5 +1,4 @@ import {clearBulkEditDraftTransaction, initBulkEditDraftTransaction, updateBulkEditDraftTransaction, updateMultipleMoneyRequests} from '@libs/actions/IOU/BulkEdit'; -import {getCurrencyDecimals, getCurrencySymbol} from '@libs/CurrencyUtils'; import CONST from '@src/CONST'; import * as API from '@src/libs/API'; @@ -16,7 +15,7 @@ import {createRandomReport} from '../../utils/collections/reports'; import createRandomTransaction from '../../utils/collections/transaction'; import createMock from '../../utils/createMock'; import getOnyxValue from '../../utils/getOnyxValue'; -import {getRequiredOnyxUpdates, getRequiredWriteCall} from '../../utils/TestHelper'; +import {getCurrencyDecimalsLocal, getCurrencySymbolLocal, getRequiredOnyxUpdates, getRequiredWriteCall} from '../../utils/TestHelper'; import {isObject, parseJSONRecord} from '../../utils/typeGuards'; import waitForBatchedUpdates from '../../utils/waitForBatchedUpdates'; @@ -101,8 +100,8 @@ describe('actions/IOU/BulkEdit', () => { hash: undefined, currentUserAccountID: RORY_ACCOUNT_ID, delegateAccountID: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); const updates = getBulkEditUpdates(writeSpy); @@ -176,8 +175,8 @@ describe('actions/IOU/BulkEdit', () => { hash: undefined, currentUserAccountID: RORY_ACCOUNT_ID, delegateAccountID: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(writeSpy).not.toHaveBeenCalled(); @@ -240,8 +239,8 @@ describe('actions/IOU/BulkEdit', () => { hash: undefined, currentUserAccountID: RORY_ACCOUNT_ID, delegateAccountID: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); const getOptimisticTotal = (callIndex: number) => { @@ -313,8 +312,8 @@ describe('actions/IOU/BulkEdit', () => { hash: undefined, currentUserAccountID: RORY_ACCOUNT_ID, delegateAccountID: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); const updates = getBulkEditUpdates(writeSpy); @@ -390,8 +389,8 @@ describe('actions/IOU/BulkEdit', () => { hash: undefined, currentUserAccountID: RORY_ACCOUNT_ID, delegateAccountID: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); const updates = getBulkEditUpdates(writeSpy); @@ -457,8 +456,8 @@ describe('actions/IOU/BulkEdit', () => { hash: undefined, currentUserAccountID: RORY_ACCOUNT_ID, delegateAccountID: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); const updates = getBulkEditUpdates(writeSpy); @@ -523,8 +522,8 @@ describe('actions/IOU/BulkEdit', () => { hash: undefined, currentUserAccountID: RORY_ACCOUNT_ID, delegateAccountID: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(writeSpy).toHaveBeenCalled(); @@ -595,8 +594,8 @@ describe('actions/IOU/BulkEdit', () => { hash: undefined, currentUserAccountID: RORY_ACCOUNT_ID, delegateAccountID: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); await waitForBatchedUpdates(); @@ -654,8 +653,8 @@ describe('actions/IOU/BulkEdit', () => { hash: undefined, currentUserAccountID: RORY_ACCOUNT_ID, delegateAccountID: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); await waitForBatchedUpdates(); @@ -716,8 +715,8 @@ describe('actions/IOU/BulkEdit', () => { hash: undefined, currentUserAccountID: RORY_ACCOUNT_ID, delegateAccountID: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); await waitForBatchedUpdates(); @@ -785,8 +784,8 @@ describe('actions/IOU/BulkEdit', () => { hash: undefined, currentUserAccountID: RORY_ACCOUNT_ID, delegateAccountID: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); await waitForBatchedUpdates(); @@ -854,8 +853,8 @@ describe('actions/IOU/BulkEdit', () => { }, currentUserAccountID: RORY_ACCOUNT_ID, delegateAccountID: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); await waitForBatchedUpdates(); @@ -934,8 +933,8 @@ describe('actions/IOU/BulkEdit', () => { }, currentUserAccountID: RORY_ACCOUNT_ID, delegateAccountID: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); await waitForBatchedUpdates(); @@ -1002,8 +1001,8 @@ describe('actions/IOU/BulkEdit', () => { hash: undefined, currentUserAccountID: RORY_ACCOUNT_ID, delegateAccountID: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); await waitForBatchedUpdates(); @@ -1082,8 +1081,8 @@ describe('actions/IOU/BulkEdit', () => { hash: undefined, currentUserAccountID: RORY_ACCOUNT_ID, delegateAccountID: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); await waitForBatchedUpdates(); @@ -1143,8 +1142,8 @@ describe('actions/IOU/BulkEdit', () => { hash: undefined, currentUserAccountID: RORY_ACCOUNT_ID, delegateAccountID: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); // category/billable changes must be silently dropped for IOUs — @@ -1211,8 +1210,8 @@ describe('actions/IOU/BulkEdit', () => { hash: undefined, currentUserAccountID: 1, delegateAccountID: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(writeSpy).toHaveBeenCalled(); @@ -1302,8 +1301,8 @@ describe('actions/IOU/BulkEdit', () => { allPolicies, currentUserAccountID: RORY_ACCOUNT_ID, delegateAccountID: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); // Then: the optimistic transaction update should use the transaction's own policy for tax resolution. @@ -1398,8 +1397,8 @@ describe('actions/IOU/BulkEdit', () => { allPolicies, currentUserAccountID: RORY_ACCOUNT_ID, delegateAccountID: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); // Then: buildOptimisticModifiedExpenseReportAction should receive the transaction's own policy, @@ -1471,8 +1470,8 @@ describe('actions/IOU/BulkEdit', () => { hash: undefined, currentUserAccountID: RORY_ACCOUNT_ID, delegateAccountID: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); const updates = getBulkEditUpdates(writeSpy); @@ -1544,8 +1543,8 @@ describe('actions/IOU/BulkEdit', () => { hash: undefined, currentUserAccountID: RORY_ACCOUNT_ID, delegateAccountID: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); const updates = getBulkEditUpdates(writeSpy); @@ -1610,8 +1609,8 @@ describe('actions/IOU/BulkEdit', () => { hash: undefined, currentUserAccountID: RORY_ACCOUNT_ID, delegateAccountID: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); const updates = getBulkEditUpdates(writeSpy); @@ -1670,8 +1669,8 @@ describe('actions/IOU/BulkEdit', () => { hash: undefined, currentUserAccountID: RORY_ACCOUNT_ID, delegateAccountID: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(writeSpy).toHaveBeenCalled(); @@ -1778,8 +1777,8 @@ describe('actions/IOU/BulkEdit', () => { hash: undefined, currentUserAccountID: RORY_ACCOUNT_ID, delegateAccountID: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(writeSpy).toHaveBeenCalled(); @@ -1874,8 +1873,8 @@ describe('actions/IOU/BulkEdit', () => { currentUserAccountID: RORY_ACCOUNT_ID, delegateAccountID: undefined, personalDetailsList: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); const iouReportNames = getOptimisticReportNamesFromWriteSpy(writeSpy, iouReportID); @@ -1960,8 +1959,8 @@ describe('actions/IOU/BulkEdit', () => { currentUserAccountID: RORY_ACCOUNT_ID, delegateAccountID: undefined, personalDetailsList: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); const iouReportNames = getOptimisticReportNamesFromWriteSpy(writeSpy, iouReportID); @@ -2061,8 +2060,8 @@ describe('actions/IOU/BulkEdit', () => { currentUserAccountID: RORY_ACCOUNT_ID, delegateAccountID: undefined, personalDetailsList: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); const iouReportNames = getOptimisticReportNamesFromWriteSpy(writeSpy, iouReportID); @@ -2146,8 +2145,8 @@ describe('actions/IOU/BulkEdit', () => { currentUserAccountID: RORY_ACCOUNT_ID, delegateAccountID: undefined, personalDetailsList: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); const iouReportNames = getOptimisticReportNamesFromWriteSpy(writeSpy, iouReportID); @@ -2224,8 +2223,8 @@ describe('actions/IOU/BulkEdit', () => { currentUserAccountID: RORY_ACCOUNT_ID, delegateAccountID: undefined, personalDetailsList: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); const iouReportNames = getOptimisticReportNamesFromWriteSpy(writeSpy, iouReportID); @@ -2304,8 +2303,8 @@ describe('actions/IOU/BulkEdit', () => { currentUserAccountID: RORY_ACCOUNT_ID, delegateAccountID: undefined, personalDetailsList: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); const iouReportNames = getOptimisticReportNamesFromWriteSpy(writeSpy, iouReportID); diff --git a/tests/actions/IOUTest/SplitTest.ts b/tests/actions/IOUTest/SplitTest.ts index 2fac119dd42b..ec996875cf91 100644 --- a/tests/actions/IOUTest/SplitTest.ts +++ b/tests/actions/IOUTest/SplitTest.ts @@ -11,7 +11,6 @@ import {addComment, notifyNewAction} from '@libs/actions/Report'; import initSplitExpense from '@libs/actions/SplitExpenses'; import type * as API from '@libs/API'; import {WRITE_COMMANDS} from '@libs/API/types'; -import {getCurrencyDecimals, getCurrencySymbol} from '@libs/CurrencyUtils'; import {rand64} from '@libs/NumberUtils'; import {getIOUActionForReportID, getIOUActionForTransactionID, getOriginalMessage, isActionOfType, isAddCommentAction, isDeletedAction, isMoneyRequestAction} from '@libs/ReportActionsUtils'; import {buildOptimisticIOUReportAction, getAncestors, getReportOrDraftReport} from '@libs/ReportUtils'; @@ -6706,7 +6705,7 @@ describe('initSplitExpense', () => { reportID: '456', }; - initSplitExpense(transaction, undefined, undefined, undefined, undefined, undefined, getCurrencyDecimals, getCurrencySymbol); + initSplitExpense(transaction, undefined, undefined, undefined, undefined, undefined, getCurrencyDecimalsLocal, getCurrencySymbolLocal); await waitForBatchedUpdates(); const draftTransaction = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${transaction.transactionID}`); @@ -6731,7 +6730,7 @@ describe('initSplitExpense', () => { }); it('should not initialize split expense for null transaction', async () => { const transaction: Transaction | undefined = undefined; - initSplitExpense(transaction, undefined, undefined, undefined, undefined, undefined, getCurrencyDecimals, getCurrencySymbol); + initSplitExpense(transaction, undefined, undefined, undefined, undefined, undefined, getCurrencyDecimalsLocal, getCurrencySymbolLocal); await waitForBatchedUpdates(); expect(transaction).toBeFalsy(); @@ -6755,7 +6754,7 @@ describe('initSplitExpense', () => { reportID: '456', }; - initSplitExpense(transaction, undefined, undefined, undefined, undefined, undefined, getCurrencyDecimals, getCurrencySymbol); + initSplitExpense(transaction, undefined, undefined, undefined, undefined, undefined, getCurrencyDecimalsLocal, getCurrencySymbolLocal); await waitForBatchedUpdates(); const draftTransaction = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${transaction.transactionID}`); @@ -6825,7 +6824,7 @@ describe('initSplitExpense', () => { reportID: '456', }; - initSplitExpense(transaction, undefined, policy, undefined, undefined, undefined, getCurrencyDecimals, getCurrencySymbol); + initSplitExpense(transaction, undefined, policy, undefined, undefined, undefined, getCurrencyDecimalsLocal, getCurrencySymbolLocal); await waitForBatchedUpdates(); const draftTransaction = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${transaction.transactionID}`); @@ -6898,7 +6897,7 @@ describe('initSplitExpense', () => { await waitForBatchedUpdates(); // When the user initiates a split on the remaining transaction - initSplitExpense(remainingTransaction, undefined, undefined, undefined, undefined, undefined, getCurrencyDecimals, getCurrencySymbol); + initSplitExpense(remainingTransaction, undefined, undefined, undefined, undefined, undefined, getCurrencyDecimalsLocal, getCurrencySymbolLocal); await waitForBatchedUpdates(); // Then a fresh split is started keyed by the remaining transaction (2 new splits) @@ -6959,7 +6958,7 @@ describe('initSplitExpense', () => { await waitForBatchedUpdates(); // When the user opens the edit-splits flow from one of the children - initSplitExpense(secondChildTransaction, undefined, undefined, undefined, undefined, undefined, getCurrencyDecimals, getCurrencySymbol); + initSplitExpense(secondChildTransaction, undefined, undefined, undefined, undefined, undefined, getCurrencyDecimalsLocal, getCurrencySymbolLocal); await waitForBatchedUpdates(); // Then the edit-splits draft is keyed by the original transaction and rebuilt from the existing children @@ -6989,7 +6988,7 @@ describe('initSplitExpense', () => { }; // When the workspace is billing-restricted, the caller passes the restricted policy ID - initSplitExpense(transaction, undefined, undefined, undefined, '7', undefined, getCurrencyDecimals, getCurrencySymbol); + initSplitExpense(transaction, undefined, undefined, undefined, '7', undefined, getCurrencyDecimalsLocal, getCurrencySymbolLocal); await waitForBatchedUpdates(); // Then the user is redirected to the restricted action page and no split draft is created @@ -7051,7 +7050,7 @@ describe('initSplitExpense', () => { reportID: '456', }; - initSplitExpense(transaction, undefined, effectivePolicy, undefined, undefined, undefined, getCurrencyDecimals, getCurrencySymbol); + initSplitExpense(transaction, undefined, effectivePolicy, undefined, undefined, undefined, getCurrencyDecimalsLocal, getCurrencySymbolLocal); await waitForBatchedUpdates(); const draftTransaction = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${transaction.transactionID}`); @@ -7097,7 +7096,7 @@ describe('initSplitExpense', () => { }; // No effectivePolicy (P2P), and personalPolicyOutputCurrency = 'EUR' passed as the 6th argument. - initSplitExpense(transaction, undefined, undefined, undefined, undefined, 'EUR', getCurrencyDecimals, getCurrencySymbol); + initSplitExpense(transaction, undefined, undefined, undefined, undefined, 'EUR', getCurrencyDecimalsLocal, getCurrencySymbolLocal); await waitForBatchedUpdates(); const draftTransaction = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${transaction.transactionID}`); @@ -7168,7 +7167,7 @@ describe('addSplitExpenseField', () => { reportID: '456', }; - addSplitExpenseField(transaction, draftTransaction, expenseReport, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + addSplitExpenseField(transaction, draftTransaction, expenseReport, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); const updatedDraftTransaction = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${transaction.transactionID}`); @@ -7231,7 +7230,7 @@ describe('addSplitExpenseField', () => { }; // Action: Add a new split expense field - addSplitExpenseField(cardTransaction, draftTransaction, expenseReport, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + addSplitExpenseField(cardTransaction, draftTransaction, expenseReport, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); const updatedDraftTransaction = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${cardTransaction.transactionID}`); @@ -7268,7 +7267,7 @@ describe('addSplitExpenseField', () => { reportID: '456', }; - addSplitExpenseField(undefined, draftTransaction, expenseReport, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + addSplitExpenseField(undefined, draftTransaction, expenseReport, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); const result = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}guard-orig`); @@ -7286,7 +7285,7 @@ describe('addSplitExpenseField', () => { reportID: '456', }; - addSplitExpenseField(transaction, undefined, expenseReport, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + addSplitExpenseField(transaction, undefined, expenseReport, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); const result = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}guard-tx`); @@ -7319,7 +7318,7 @@ describe('addSplitExpenseField', () => { reportID: '456', }; - addSplitExpenseField(transaction, draftTransaction, expenseReport, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + addSplitExpenseField(transaction, draftTransaction, expenseReport, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); // Should write to the originalTransactionID key, not transaction.transactionID @@ -7363,7 +7362,7 @@ describe('addSplitExpenseField', () => { reportID: '456', }; - addSplitExpenseField(transaction, draftTransaction, expenseReport, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + addSplitExpenseField(transaction, draftTransaction, expenseReport, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); const updatedDraft = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}manual-sum`); @@ -7408,7 +7407,7 @@ describe('addSplitExpenseField', () => { reportID: '456', }; - addSplitExpenseField(transaction, draftTransaction, expenseReport, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + addSplitExpenseField(transaction, draftTransaction, expenseReport, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); const updatedDraft = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}manual-no-sum`); @@ -7453,7 +7452,7 @@ describe('addSplitExpenseField', () => { reportID: '456', }; - addSplitExpenseField(transaction, draftTransaction, expenseReport, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + addSplitExpenseField(transaction, draftTransaction, expenseReport, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); const updatedDraft = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}unedited-sum`); @@ -7491,7 +7490,7 @@ describe('addSplitExpenseField', () => { reportID: '456', }; - addSplitExpenseField(transaction, draftTransaction, expenseReport, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + addSplitExpenseField(transaction, draftTransaction, expenseReport, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); const updatedDraft = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}dates-reset`); @@ -7525,7 +7524,7 @@ describe('addSplitExpenseField', () => { reportID: '456', }; - addSplitExpenseField(transaction, draftTransaction, expenseReport, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + addSplitExpenseField(transaction, draftTransaction, expenseReport, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); const updatedDraft = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}empty-start`); @@ -7630,7 +7629,7 @@ describe('addSplitExpenseField', () => { currency: 'USD', }; - addSplitExpenseField(transaction, draftTransaction, transactionReport, policy, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + addSplitExpenseField(transaction, draftTransaction, transactionReport, policy, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); const updatedDraftTransaction = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${transaction.transactionID}`); @@ -7705,7 +7704,7 @@ describe('addSplitExpenseField', () => { const transactionReport: Report = {reportID: '456', type: CONST.REPORT.TYPE.EXPENSE, total: 20000, currency: 'USD'}; // When another split is added - addSplitExpenseField(transaction, draftTransaction, transactionReport, policy, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + addSplitExpenseField(transaction, draftTransaction, transactionReport, policy, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); // Then it is stored on that same unit, so the merchant and the Distance field agree @@ -7757,7 +7756,7 @@ describe('addSplitExpenseField', () => { reportID: '456', }; - addSplitExpenseField(transaction, draftTransaction, expenseReport, undefined, false, 'EUR', getCurrencySymbol, getCurrencyDecimalsLocal); + addSplitExpenseField(transaction, draftTransaction, expenseReport, undefined, false, 'EUR', getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); const updatedDraft = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}p2p-eur`); @@ -7809,7 +7808,7 @@ describe('addSplitExpenseField', () => { reportID: '456', }; - addSplitExpenseField(transaction, draftTransaction, expenseReport, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + addSplitExpenseField(transaction, draftTransaction, expenseReport, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); const updatedDraft = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}p2p-usd`); @@ -7844,7 +7843,7 @@ describe('evenlyDistributeSplitExpenseAmounts', () => { reportID: 'rep-2', }; - evenlyDistributeSplitExpenseAmounts(draftTransaction, undefined, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + evenlyDistributeSplitExpenseAmounts(draftTransaction, undefined, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); const updatedDraft = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${originalTransactionID}`); @@ -7871,7 +7870,7 @@ describe('evenlyDistributeSplitExpenseAmounts', () => { reportID: 'rep-3', }; - evenlyDistributeSplitExpenseAmounts(draftTransaction, undefined, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + evenlyDistributeSplitExpenseAmounts(draftTransaction, undefined, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); const updatedDraft = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${originalTransactionID}`); @@ -7902,7 +7901,7 @@ describe('evenlyDistributeSplitExpenseAmounts', () => { reportID: 'rep-4', }; - evenlyDistributeSplitExpenseAmounts(draftTransaction, undefined, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + evenlyDistributeSplitExpenseAmounts(draftTransaction, undefined, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); const updatedDraft = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${originalTransactionID}`); @@ -7931,7 +7930,7 @@ describe('evenlyDistributeSplitExpenseAmounts', () => { reportID: 'rep-5', }; - evenlyDistributeSplitExpenseAmounts(draftTransaction, undefined, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + evenlyDistributeSplitExpenseAmounts(draftTransaction, undefined, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); const updatedDraft = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${originalTransactionID}`); @@ -7960,7 +7959,7 @@ describe('evenlyDistributeSplitExpenseAmounts', () => { reportID: 'rep-6', }; - evenlyDistributeSplitExpenseAmounts(draftTransaction, undefined, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + evenlyDistributeSplitExpenseAmounts(draftTransaction, undefined, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); const updatedDraft = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${originalTransactionID}`); @@ -7990,7 +7989,7 @@ describe('evenlyDistributeSplitExpenseAmounts', () => { reportID: 'rep-7', }; - evenlyDistributeSplitExpenseAmounts(draftTransaction, undefined, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + evenlyDistributeSplitExpenseAmounts(draftTransaction, undefined, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); const updatedDraft = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${originalTransactionID}`); @@ -8021,7 +8020,7 @@ describe('evenlyDistributeSplitExpenseAmounts', () => { reportID: 'rep-neg-3', }; - evenlyDistributeSplitExpenseAmounts(draftTransaction, undefined, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + evenlyDistributeSplitExpenseAmounts(draftTransaction, undefined, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); const updatedDraft = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${originalTransactionID}`); @@ -8051,7 +8050,7 @@ describe('evenlyDistributeSplitExpenseAmounts', () => { reportID: 'rep-neg-2', }; - evenlyDistributeSplitExpenseAmounts(draftTransaction, undefined, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + evenlyDistributeSplitExpenseAmounts(draftTransaction, undefined, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); const updatedDraft = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${originalTransactionID}`); @@ -8152,7 +8151,7 @@ describe('evenlyDistributeSplitExpenseAmounts', () => { }; const originalTransaction = await getOnyxValue(`${ONYXKEYS.COLLECTION.TRANSACTION}${originalTransactionID}`); - evenlyDistributeSplitExpenseAmounts(draftTransaction, originalTransaction, policy, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + evenlyDistributeSplitExpenseAmounts(draftTransaction, originalTransaction, policy, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); const updatedDraft = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${originalTransactionID}`); @@ -8254,7 +8253,7 @@ describe('evenlyDistributeSplitExpenseAmounts', () => { // When the splits are distributed evenly const originalTransaction = await getOnyxValue(`${ONYXKEYS.COLLECTION.TRANSACTION}${originalTransactionID}`); - evenlyDistributeSplitExpenseAmounts(draftTransaction, originalTransaction, expensePolicy, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal, { + evenlyDistributeSplitExpenseAmounts(draftTransaction, originalTransaction, expensePolicy, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal, { [`${ONYXKEYS.COLLECTION.POLICY}${selectedRatePolicy.id}`]: selectedRatePolicy, }); await waitForBatchedUpdates(); @@ -8301,7 +8300,7 @@ describe('updateSplitExpenseAmountField', () => { reportID: '456', }; - updateSplitExpenseAmountField(draftTransaction, currentTransactionID, 20, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + updateSplitExpenseAmountField(draftTransaction, currentTransactionID, 20, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); const updatedDraftTransaction = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${originalTransactionID}`); @@ -8393,7 +8392,7 @@ describe('updateSplitExpenseAmountField', () => { reportID: '456', }; - updateSplitExpenseAmountField(draftTransaction, currentTransactionID, 15000, policy, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + updateSplitExpenseAmountField(draftTransaction, currentTransactionID, 15000, policy, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); const updatedDraftTransaction = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${originalTransactionID}`); @@ -8490,7 +8489,7 @@ describe('updateSplitExpenseAmountField', () => { }; // When the amount of the split is edited - updateSplitExpenseAmountField(draftTransaction, currentTransactionID, 15000, policy, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + updateSplitExpenseAmountField(draftTransaction, currentTransactionID, 15000, policy, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); // Then the split stays on the unit the expense is stored with, and the distance it stores is expressed in that @@ -8900,7 +8899,7 @@ describe('resetSplitExpensesByDateRange', () => { policy: undefined, isSelfDMSplit: false, personalPolicyOutputCurrency: undefined, - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, getCurrencyDecimals: getCurrencyDecimalsLocal, }); await waitForBatchedUpdates(); @@ -9000,7 +8999,7 @@ describe('resetSplitExpensesByDateRange', () => { policy, isSelfDMSplit: false, personalPolicyOutputCurrency: undefined, - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, getCurrencyDecimals: getCurrencyDecimalsLocal, }); await waitForBatchedUpdates(); @@ -9062,7 +9061,7 @@ describe('resetSplitExpensesByDateRange', () => { policy: undefined, isSelfDMSplit: false, personalPolicyOutputCurrency: undefined, - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, getCurrencyDecimals: getCurrencyDecimalsLocal, }); await waitForBatchedUpdates(); @@ -9085,7 +9084,7 @@ describe('resetSplitExpensesByDateRange', () => { policy: undefined, isSelfDMSplit: false, personalPolicyOutputCurrency: undefined, - getCurrencySymbol, + getCurrencySymbol: getCurrencySymbolLocal, getCurrencyDecimals: getCurrencyDecimalsLocal, }); await waitForBatchedUpdates(); @@ -9227,7 +9226,7 @@ describe('updateSplitExpenseField', () => { reportID: '456', }; - updateSplitExpenseField(splitExpenseDraftTransaction, originalTransactionDraft, splitExpenseTransactionID, originalTransaction, undefined, false, undefined, getCurrencySymbol); + updateSplitExpenseField(splitExpenseDraftTransaction, originalTransactionDraft, splitExpenseTransactionID, originalTransaction, undefined, false, undefined, getCurrencySymbolLocal); await waitForBatchedUpdates(); const updatedDraft = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${originalTransactionID}`); @@ -9363,7 +9362,7 @@ describe('updateSplitExpenseField', () => { reportID: '456', }; - updateSplitExpenseField(splitExpenseDraftTransaction, originalTransactionDraft, splitExpenseTransactionID, originalTransaction, policy, false, undefined, getCurrencySymbol); + updateSplitExpenseField(splitExpenseDraftTransaction, originalTransactionDraft, splitExpenseTransactionID, originalTransaction, policy, false, undefined, getCurrencySymbolLocal); await waitForBatchedUpdates(); const updatedDraft = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${originalTransactionID}`); @@ -9483,7 +9482,7 @@ describe('updateSplitExpenseField', () => { reportID: '456', }; - updateSplitExpenseField(splitExpenseDraftTransaction, originalTransactionDraft, splitExpenseTransactionID, originalTransaction, policy, false, undefined, getCurrencySymbol); + updateSplitExpenseField(splitExpenseDraftTransaction, originalTransactionDraft, splitExpenseTransactionID, originalTransaction, policy, false, undefined, getCurrencySymbolLocal); await waitForBatchedUpdates(); const updatedDraft = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${originalTransactionID}`); @@ -9602,7 +9601,7 @@ describe('updateSplitExpenseField', () => { reportID: '456', }; - updateSplitExpenseField(splitExpenseDraftTransaction, originalTransactionDraft, splitExpenseTransactionID, originalTransaction, policy, false, undefined, getCurrencySymbol); + updateSplitExpenseField(splitExpenseDraftTransaction, originalTransactionDraft, splitExpenseTransactionID, originalTransaction, policy, false, undefined, getCurrencySymbolLocal); await waitForBatchedUpdates(); const updatedDraft = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${originalTransactionID}`); @@ -9670,7 +9669,7 @@ describe('updateSplitExpenseField', () => { reportID: '456', }; - updateSplitExpenseField(splitExpenseDraftTransaction, originalTransactionDraft, splitExpenseTransactionID, originalTransaction, undefined, false, undefined, getCurrencySymbol); + updateSplitExpenseField(splitExpenseDraftTransaction, originalTransactionDraft, splitExpenseTransactionID, originalTransaction, undefined, false, undefined, getCurrencySymbolLocal); await waitForBatchedUpdates(); const updatedDraft = await getOnyxValue(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${originalTransactionID}`); diff --git a/tests/actions/IOUTest/UpdateMoneyRequestTest.ts b/tests/actions/IOUTest/UpdateMoneyRequestTest.ts index e6af5d5d4be6..12cbffea17cd 100644 --- a/tests/actions/IOUTest/UpdateMoneyRequestTest.ts +++ b/tests/actions/IOUTest/UpdateMoneyRequestTest.ts @@ -14,7 +14,6 @@ import initOnyxDerivedValues from '@libs/actions/OnyxDerived'; import {editTransactionMerchantInline} from '@libs/actions/TransactionInlineEdit'; import * as API from '@libs/API'; import {WRITE_COMMANDS} from '@libs/API/types'; -import {getCurrencyDecimals, getCurrencySymbol} from '@libs/CurrencyUtils'; import type * as PolicyUtils from '@libs/PolicyUtils'; import {getOriginalMessage, isActionOfType} from '@libs/ReportActionsUtils'; import {buildOptimisticIOUReportAction} from '@libs/ReportUtils'; @@ -182,8 +181,8 @@ describe('actions/IOU/UpdateMoneyRequest', () => { isASAPSubmitBetaEnabled: false, delegateAccountID: undefined, isTrackIntentUser: false, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); await waitForBatchedUpdates(); @@ -268,8 +267,8 @@ describe('actions/IOU/UpdateMoneyRequest', () => { isASAPSubmitBetaEnabled: false, delegateAccountID: undefined, isTrackIntentUser: false, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); await waitForBatchedUpdates(); @@ -320,8 +319,8 @@ describe('actions/IOU/UpdateMoneyRequest', () => { isASAPSubmitBetaEnabled: false, delegateAccountID: undefined, isTrackIntentUser: false, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); await waitForBatchedUpdates(); @@ -383,8 +382,8 @@ describe('actions/IOU/UpdateMoneyRequest', () => { isASAPSubmitBetaEnabled: false, delegateAccountID: undefined, isTrackIntentUser: false, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); await waitForBatchedUpdates(); @@ -988,8 +987,8 @@ describe('actions/IOU/UpdateMoneyRequest', () => { delegateAccountID: undefined, isOffline: false, isTrackIntentUser: false, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); await waitForBatchedUpdates(); @@ -1182,8 +1181,8 @@ describe('actions/IOU/UpdateMoneyRequest', () => { odometerEnd: 15000, delegateAccountID: undefined, isTrackIntentUser: false, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); mockFetch.resume(); @@ -1285,8 +1284,8 @@ describe('actions/IOU/UpdateMoneyRequest', () => { isASAPSubmitBetaEnabled: false, delegateAccountID: undefined, isTrackIntentUser: false, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); await waitForBatchedUpdates(); @@ -1400,8 +1399,8 @@ describe('actions/IOU/UpdateMoneyRequest', () => { odometerEnd: 50350, delegateAccountID: undefined, isTrackIntentUser: false, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); mockFetch.resume(); @@ -1477,8 +1476,8 @@ describe('actions/IOU/UpdateMoneyRequest', () => { isASAPSubmitBetaEnabled: false, delegateAccountID: undefined, isTrackIntentUser: false, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); await waitForBatchedUpdates(); @@ -1535,8 +1534,8 @@ describe('actions/IOU/UpdateMoneyRequest', () => { isASAPSubmitBetaEnabled: false, delegateAccountID: undefined, isTrackIntentUser: false, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); await waitForBatchedUpdates(); @@ -1619,8 +1618,8 @@ describe('actions/IOU/UpdateMoneyRequest', () => { isASAPSubmitBetaEnabled: false, delegateAccountID: undefined, isTrackIntentUser: false, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); await waitForBatchedUpdates(); @@ -2245,8 +2244,8 @@ describe('actions/IOU/UpdateMoneyRequest', () => { isOffline: false, delegateAccountID: undefined, isTrackIntentUser: false, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(writeSpy).not.toHaveBeenCalledWith(WRITE_COMMANDS.UPDATE_MONEY_REQUEST_DATE, expect.anything(), expect.anything()); @@ -2376,8 +2375,8 @@ describe('actions/IOU/UpdateMoneyRequest', () => { isOffline: false, delegateAccountID: undefined, isTrackIntentUser: false, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(writeSpy).toHaveBeenCalledWith(WRITE_COMMANDS.UPDATE_MONEY_REQUEST_DATE, expect.objectContaining({transactionID, created: '2025-06-15'}), expect.anything()); @@ -2476,8 +2475,8 @@ describe('actions/IOU/UpdateMoneyRequest', () => { isOffline: false, delegateAccountID: undefined, isTrackIntentUser: false, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(writeSpy).not.toHaveBeenCalledWith(WRITE_COMMANDS.UPDATE_MONEY_REQUEST_DATE, expect.anything(), expect.anything()); @@ -2597,8 +2596,8 @@ describe('actions/IOU/UpdateMoneyRequest', () => { isOffline: false, delegateAccountID: undefined, isTrackIntentUser: false, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(writeSpy).toHaveBeenCalledWith(WRITE_COMMANDS.UPDATE_MONEY_REQUEST_DATE, expect.objectContaining({transactionID, created: '2027-06-15'}), expect.anything()); @@ -2721,8 +2720,8 @@ describe('actions/IOU/UpdateMoneyRequest', () => { isOffline: false, delegateAccountID: undefined, isTrackIntentUser: false, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(writeSpy).not.toHaveBeenCalledWith(WRITE_COMMANDS.UPDATE_MONEY_REQUEST_DATE, expect.anything(), expect.anything()); @@ -2799,8 +2798,8 @@ describe('actions/IOU/UpdateMoneyRequest', () => { delegateAccountID: DELEGATE_ACCOUNT_ID, isTrackIntentUser: false, personalDetailsList: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }, newMerchant, ); diff --git a/tests/actions/ReportTest.ts b/tests/actions/ReportTest.ts index 16762b84924d..1286a974e39f 100644 --- a/tests/actions/ReportTest.ts +++ b/tests/actions/ReportTest.ts @@ -9963,6 +9963,7 @@ describe('actions/Report', () => { selfDMReportActions: undefined, delegateAccountID: undefined, getCurrencyDecimals: TestHelper.getCurrencyDecimalsLocal, + getCurrencySymbol: TestHelper.getCurrencySymbolLocal, }); await waitForBatchedUpdates(); @@ -10040,6 +10041,7 @@ describe('actions/Report', () => { selfDMReportActions: undefined, delegateAccountID: undefined, getCurrencyDecimals: TestHelper.getCurrencyDecimalsLocal, + getCurrencySymbol: TestHelper.getCurrencySymbolLocal, }); await waitForBatchedUpdates(); @@ -10107,6 +10109,7 @@ describe('actions/Report', () => { selfDMReportActions: undefined, delegateAccountID: undefined, getCurrencyDecimals: TestHelper.getCurrencyDecimalsLocal, + getCurrencySymbol: TestHelper.getCurrencySymbolLocal, }); await waitForBatchedUpdates(); diff --git a/tests/actions/TransactionTest.ts b/tests/actions/TransactionTest.ts index 3a2343c5e92a..fa99846f2238 100644 --- a/tests/actions/TransactionTest.ts +++ b/tests/actions/TransactionTest.ts @@ -41,7 +41,7 @@ import waitForBatchedUpdates from '../utils/waitForBatchedUpdates'; type LegacyChangeTransactionsReportProps = Omit< Parameters[0], - 'transactions' | 'allTransactionViolation' | 'personalPolicyOutputCurrency' | 'selfDMReportActions' | 'delegateAccountID' | 'getCurrencyDecimals' + 'transactions' | 'allTransactionViolation' | 'personalPolicyOutputCurrency' | 'selfDMReportActions' | 'delegateAccountID' | 'getCurrencyDecimals' | 'getCurrencySymbol' > & { allTransactions: OnyxCollection; transactionViolations: Parameters[0]['allTransactionViolation']; @@ -60,6 +60,7 @@ function changeTransactionsReport({allTransactions, transactionIDs, transactionV selfDMReportActions, delegateAccountID: undefined, getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, ...rest, }); } diff --git a/tests/unit/SplitExpenseAutoAdjustmentTest.ts b/tests/unit/SplitExpenseAutoAdjustmentTest.ts index f107054b9371..61b69fa85be7 100644 --- a/tests/unit/SplitExpenseAutoAdjustmentTest.ts +++ b/tests/unit/SplitExpenseAutoAdjustmentTest.ts @@ -1,5 +1,4 @@ import {addSplitExpenseField, evenlyDistributeSplitExpenseAmounts, removeSplitExpenseField, updateSplitExpenseAmountField} from '@libs/actions/IOU/SplitExpenseItems'; -import {getCurrencySymbol} from '@libs/CurrencyUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -11,7 +10,7 @@ import type {OnyxEntry} from 'react-native-onyx'; import Onyx from 'react-native-onyx'; import createMock from '../utils/createMock'; -import {getCurrencyDecimalsLocal} from '../utils/TestHelper'; +import {getCurrencyDecimalsLocal, getCurrencySymbolLocal} from '../utils/TestHelper'; import waitForBatchedUpdates from '../utils/waitForBatchedUpdates'; /** @@ -74,7 +73,7 @@ describe('Split Expense Auto-Adjustment', () => { await waitForBatchedUpdates(); // Action: Add a third split - addSplitExpenseField(mockTransaction, mockTransaction, undefined, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + addSplitExpenseField(mockTransaction, mockTransaction, undefined, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); // Verify: Should be 3 splits at ~$3.33/$3.33/$3.34 (33/33/34%) @@ -112,7 +111,7 @@ describe('Split Expense Auto-Adjustment', () => { await waitForBatchedUpdates(); // Action: Add a new split - addSplitExpenseField(mockTransaction, mockTransaction, undefined, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + addSplitExpenseField(mockTransaction, mockTransaction, undefined, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); // Verify: 3 splits @@ -151,7 +150,7 @@ describe('Split Expense Auto-Adjustment', () => { await waitForBatchedUpdates(); // Action: Add a new split - addSplitExpenseField(mockTransaction, mockTransaction, undefined, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + addSplitExpenseField(mockTransaction, mockTransaction, undefined, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); const draftTransaction = await new Promise>((resolve) => { @@ -215,7 +214,7 @@ describe('Split Expense Auto-Adjustment', () => { await Onyx.set(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${originalTransactionID}`, draftTransaction); await waitForBatchedUpdates(); - addSplitExpenseField(transaction, draftTransaction, undefined, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + addSplitExpenseField(transaction, draftTransaction, undefined, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); const updatedDraft = await new Promise>((resolve) => { @@ -247,7 +246,7 @@ describe('Split Expense Auto-Adjustment', () => { await waitForBatchedUpdates(); // Action: Add new split - addSplitExpenseField(mockTransaction, mockTransaction, undefined, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + addSplitExpenseField(mockTransaction, mockTransaction, undefined, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); // Verify: New split should stay at 0 (not redistributed) @@ -291,7 +290,7 @@ describe('Split Expense Auto-Adjustment', () => { await waitForBatchedUpdates(); // Action: Add new split - addSplitExpenseField(mockTransaction, mockTransaction, undefined, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + addSplitExpenseField(mockTransaction, mockTransaction, undefined, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); // Verify: All unedited splits should be redistributed @@ -451,7 +450,7 @@ describe('Split Expense Auto-Adjustment', () => { await waitForBatchedUpdates(); // Action: Edit split1 to $3.00 - updateSplitExpenseAmountField(mockTransaction, 'split1', 300, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + updateSplitExpenseAmountField(mockTransaction, 'split1', 300, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); // Verify @@ -493,7 +492,7 @@ describe('Split Expense Auto-Adjustment', () => { await waitForBatchedUpdates(); // Action: Edit split1 to $5.00 - updateSplitExpenseAmountField(mockTransaction, 'split1', 500, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + updateSplitExpenseAmountField(mockTransaction, 'split1', 500, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); // Verify: split2 should remain unchanged @@ -530,7 +529,7 @@ describe('Split Expense Auto-Adjustment', () => { await waitForBatchedUpdates(); // Action: Edit split1 to $3.00 - updateSplitExpenseAmountField(mockTransaction, 'split1', 300, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + updateSplitExpenseAmountField(mockTransaction, 'split1', 300, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); const draftTransaction = await new Promise>((resolve) => { @@ -561,7 +560,7 @@ describe('Split Expense Auto-Adjustment', () => { await waitForBatchedUpdates(); // Action: Try to update with NaN amount (simulates user entering just "-") - updateSplitExpenseAmountField(mockTransaction, 'split1', NaN, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + updateSplitExpenseAmountField(mockTransaction, 'split1', NaN, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); // Verify: Splits should remain unchanged @@ -596,7 +595,7 @@ describe('Split Expense Auto-Adjustment', () => { await waitForBatchedUpdates(); // Action: Make splits even - evenlyDistributeSplitExpenseAmounts(mockTransaction, undefined, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + evenlyDistributeSplitExpenseAmounts(mockTransaction, undefined, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); // Verify @@ -637,7 +636,7 @@ describe('Split Expense Auto-Adjustment', () => { await waitForBatchedUpdates(); // Action: Make splits even ($5/$5) - evenlyDistributeSplitExpenseAmounts(mockTransaction, originalTransaction, undefined, false, undefined, getCurrencySymbol, getCurrencyDecimalsLocal); + evenlyDistributeSplitExpenseAmounts(mockTransaction, originalTransaction, undefined, false, undefined, getCurrencySymbolLocal, getCurrencyDecimalsLocal); await waitForBatchedUpdates(); const draftTransaction = await new Promise>((resolve) => { diff --git a/tests/unit/TransactionTest.ts b/tests/unit/TransactionTest.ts index 6a01f5b3cf9c..fc791938f3ed 100644 --- a/tests/unit/TransactionTest.ts +++ b/tests/unit/TransactionTest.ts @@ -50,7 +50,7 @@ import waitForBatchedUpdates from '../utils/waitForBatchedUpdates'; type LegacyChangeTransactionsReportProps = Omit< Parameters[0], - 'transactions' | 'allTransactionViolation' | 'personalPolicyOutputCurrency' | 'selfDMReportActions' | 'delegateAccountID' | 'getCurrencyDecimals' + 'transactions' | 'allTransactionViolation' | 'personalPolicyOutputCurrency' | 'selfDMReportActions' | 'delegateAccountID' | 'getCurrencyDecimals' | 'getCurrencySymbol' > & { allTransactions: OnyxCollection; transactionViolations?: OnyxCollection; @@ -87,6 +87,7 @@ function changeTransactionsReport({allTransactions, transactionIDs, transactionV selfDMReportActions: undefined, delegateAccountID: undefined, getCurrencyDecimals: TestHelper.getCurrencyDecimalsLocal, + getCurrencySymbol: TestHelper.getCurrencySymbolLocal, ...rest, }); } diff --git a/tests/unit/TransactionUtilsTest.ts b/tests/unit/TransactionUtilsTest.ts index ecfa9cf3aaa4..38865e75f4d3 100644 --- a/tests/unit/TransactionUtilsTest.ts +++ b/tests/unit/TransactionUtilsTest.ts @@ -1,6 +1,5 @@ import type {LocaleContextProps} from '@components/LocaleContextProvider'; -import {getCurrencyDecimals, getCurrencySymbol} from '@libs/CurrencyUtils'; import DateUtils from '@libs/DateUtils'; import {translate as translateWithLocale} from '@libs/Localize'; import {doesMoneyRequestDraftHaveUserInput, shouldShowBrokenConnectionViolation, shouldShowBrokenConnectionViolationForMultipleTransactions} from '@libs/TransactionUtils'; @@ -22,6 +21,7 @@ import * as TransactionUtils from '../../src/libs/TransactionUtils'; import createRandomPolicy, {createCategoryTaxExpenseRules} from '../utils/collections/policies'; import {createRandomReport} from '../utils/collections/reports'; import createMock from '../utils/createMock'; +import {getCurrencyDecimalsLocal, getCurrencySymbolLocal} from '../utils/TestHelper'; import waitForBatchedUpdates from '../utils/waitForBatchedUpdates'; function generateTransaction(values: Partial = {}): Transaction { @@ -318,7 +318,7 @@ describe('TransactionUtils', () => { const transaction = generateTransaction(); // When retrieving the tax from the associated category - const {categoryTaxCode, categoryTaxAmount, categoryTaxValue} = TransactionUtils.getCategoryTaxDetails(category, transaction, fakePolicy, getCurrencyDecimals); + const {categoryTaxCode, categoryTaxAmount, categoryTaxValue} = TransactionUtils.getCategoryTaxDetails(category, transaction, fakePolicy, getCurrencyDecimalsLocal); // Then it should return the associated tax code, amount, and value expect(categoryTaxCode).toBe('id_TAX_RATE_1'); @@ -338,7 +338,7 @@ describe('TransactionUtils', () => { const transaction = generateTransaction(); // When retrieving the tax from a category that is not associated with the tax expense rules - const {categoryTaxCode, categoryTaxAmount, categoryTaxValue} = TransactionUtils.getCategoryTaxDetails(selectedCategory, transaction, fakePolicy, getCurrencyDecimals); + const {categoryTaxCode, categoryTaxAmount, categoryTaxValue} = TransactionUtils.getCategoryTaxDetails(selectedCategory, transaction, fakePolicy, getCurrencyDecimalsLocal); // Then it should return the default tax code, amount, and value expect(categoryTaxCode).toBe('id_TAX_EXEMPT'); @@ -370,7 +370,7 @@ describe('TransactionUtils', () => { const transaction = generateTransaction(); // When retrieving the tax from a category that is not associated with the tax expense rules - const {categoryTaxCode, categoryTaxAmount, categoryTaxValue} = TransactionUtils.getCategoryTaxDetails(selectedCategory, transaction, fakePolicy, getCurrencyDecimals); + const {categoryTaxCode, categoryTaxAmount, categoryTaxValue} = TransactionUtils.getCategoryTaxDetails(selectedCategory, transaction, fakePolicy, getCurrencyDecimalsLocal); // Then it should return the default tax code, amount, and value expect(categoryTaxCode).toBe('id_TAX_RATE_2'); @@ -393,7 +393,7 @@ describe('TransactionUtils', () => { }; // When retrieving the tax from the associated category - const {categoryTaxCode, categoryTaxAmount, categoryTaxValue} = TransactionUtils.getCategoryTaxDetails(category, transaction, fakePolicy, getCurrencyDecimals); + const {categoryTaxCode, categoryTaxAmount, categoryTaxValue} = TransactionUtils.getCategoryTaxDetails(category, transaction, fakePolicy, getCurrencyDecimalsLocal); // Then it should return undefined for the tax code, amount, and value expect(categoryTaxCode).toBe(undefined); @@ -412,7 +412,7 @@ describe('TransactionUtils', () => { const transaction = generateTransaction(); // When retrieving the tax from a category - const {categoryTaxCode, categoryTaxAmount, categoryTaxValue} = TransactionUtils.getCategoryTaxDetails(category, transaction, fakePolicy, getCurrencyDecimals); + const {categoryTaxCode, categoryTaxAmount, categoryTaxValue} = TransactionUtils.getCategoryTaxDetails(category, transaction, fakePolicy, getCurrencyDecimalsLocal); // Then it should return undefined for the tax code, amount, and value expect(categoryTaxCode).toBe(undefined); @@ -441,8 +441,8 @@ describe('TransactionUtils', () => { policy: fakePolicy, transactionChanges: {category}, personalPolicyOutputCurrency: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); // Then the updated transaction should contain the tax from the matched rule @@ -493,8 +493,8 @@ describe('TransactionUtils', () => { policy: fakePolicy, transactionChanges: {distance: newDistance}, personalPolicyOutputCurrency: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); // Then: quantity should be updated @@ -557,8 +557,8 @@ describe('TransactionUtils', () => { policy: undefined, transactionChanges: {distance: 20}, personalPolicyOutputCurrency: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(updatedTransaction.routes).toEqual(routes); @@ -604,8 +604,8 @@ describe('TransactionUtils', () => { policy: fakePolicy, transactionChanges: {customUnitRateID: 'rate2'}, personalPolicyOutputCurrency: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); // Then: the amount/merchant are recalculated locally against the new rate (10 mi × rate2), not deferred to the server @@ -652,8 +652,8 @@ describe('TransactionUtils', () => { policy: fakePolicy, transactionChanges: {customUnitRateID: 'rate2'}, personalPolicyOutputCurrency: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); // Then: the rate id updates, but amount/merchant recalculation is deferred to the server (no valid local mileage data) @@ -715,8 +715,8 @@ describe('TransactionUtils', () => { policy: fakePolicy, transactionChanges: {customUnitRateID: 'rate2'}, personalPolicyOutputCurrency: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); // Then: the rate id updates, but the stale distance is not turned into an amount/merchant @@ -781,8 +781,8 @@ describe('TransactionUtils', () => { ...(rateUnitChanged ? {customUnitRateID: 'ID2'} : {}), }, personalPolicyOutputCurrency: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); const expectedExclusion = rateUnitChanged ? 4.83 : 3; @@ -873,8 +873,8 @@ describe('TransactionUtils', () => { policy: fakePolicy, transactionChanges: {selectedRouteKey: 'route1'}, personalPolicyOutputCurrency: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); // The commute is excluded from the new route's distance, so only the 17 reimbursable miles are charged. @@ -914,14 +914,13 @@ describe('TransactionUtils', () => { policy: undefined, transactionChanges: {distance: 20}, personalPolicyOutputCurrency: 'EUR', - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); // Currency + merchant follow the threaded personal currency (EUR), and amount = 20 mi × 30¢ = 600. - // (The merchant shows the "EUR" code rather than the € glyph because the currency list isn't loaded in this unit test.) expect(updatedTransaction.modifiedCurrency).toBe('EUR'); - expect(updatedTransaction.modifiedMerchant).toContain('EUR'); + expect(updatedTransaction.modifiedMerchant).toContain('€'); expect(updatedTransaction.modifiedMerchant).toContain('0.30'); expect(updatedTransaction.modifiedAmount).toBe(600); } finally { @@ -970,13 +969,13 @@ describe('TransactionUtils', () => { }, }, personalPolicyOutputCurrency: 'EUR', - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); // Merchant currency and modifiedCurrency both follow the EUR personal-policy rate, not the USD transaction currency. expect(updatedTransaction.modifiedCurrency).toBe('EUR'); - expect(updatedTransaction.modifiedMerchant).toContain('EUR'); + expect(updatedTransaction.modifiedMerchant).toContain('€'); expect(updatedTransaction.modifiedMerchant).toContain('0.30'); expect(updatedTransaction.modifiedAmount).toBe(600); } finally { @@ -1031,8 +1030,8 @@ describe('TransactionUtils', () => { }, }, personalPolicyOutputCurrency: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(updatedTransaction.comment?.customUnit).toMatchObject({quantity: 20, commuterExclusion: 3, reimbursableDistance: 17}); @@ -1048,8 +1047,8 @@ describe('TransactionUtils', () => { isFromExpenseReport: true, transactionChanges: {amount: newAmount}, personalPolicyOutputCurrency: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(updatedTransaction.modifiedAmount).toBe(-newAmount); @@ -1064,8 +1063,8 @@ describe('TransactionUtils', () => { isFromExpenseReport: false, transactionChanges: {amount: newAmount}, personalPolicyOutputCurrency: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(updatedTransaction.modifiedAmount).toBe(newAmount); @@ -1079,8 +1078,8 @@ describe('TransactionUtils', () => { isFromExpenseReport: true, transactionChanges: {taxCode: 'id_TAX_RATE_1', taxAmount: 50, taxValue: '5%'}, personalPolicyOutputCurrency: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(updatedTransaction.taxValue).toBe('5%'); @@ -1096,8 +1095,8 @@ describe('TransactionUtils', () => { isFromExpenseReport: false, transactionChanges: {taxValue: '5%'}, personalPolicyOutputCurrency: undefined, - getCurrencyDecimals, - getCurrencySymbol, + getCurrencyDecimals: getCurrencyDecimalsLocal, + getCurrencySymbol: getCurrencySymbolLocal, }); expect(updatedTransaction.taxValue).toBe('10%');