From 2e5572268c86ba6304345dc308c3f99239d3bfe8 Mon Sep 17 00:00:00 2001 From: VH Date: Wed, 5 Nov 2025 18:04:01 +0700 Subject: [PATCH 1/3] Revert "Merge pull request #74212 from Expensify/revert-73439-fix/remove-openreport-calls-merge" This reverts commit fc841116b5deaa7895119b42228d544cd856697f, reversing changes made to 8813e2f2c9b6eb1ab80ea79f949f07157aa6ee84. --- .../ReportActionItem/MoneyRequestView.tsx | 10 +- src/libs/DebugUtils.ts | 2 + src/libs/MergeTransactionUtils.ts | 33 ++++- src/libs/actions/MergeTransaction.ts | 8 +- .../TransactionMerge/DetailsReviewPage.tsx | 7 +- .../MergeTransactionsListContent.tsx | 10 +- src/types/onyx/MergeTransaction.ts | 3 + src/types/onyx/Transaction.ts | 3 + tests/unit/MergeTransactionUtilsTest.ts | 120 ++++++++++++++++++ tests/utils/collections/mergeTransaction.ts | 1 + 10 files changed, 173 insertions(+), 24 deletions(-) diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx index 781089d1bad17..1902c32c0068e 100644 --- a/src/components/ReportActionItem/MoneyRequestView.tsx +++ b/src/components/ReportActionItem/MoneyRequestView.tsx @@ -32,7 +32,6 @@ import {getDecodedCategoryName, isCategoryMissing} from '@libs/CategoryUtils'; import {convertToDisplayString} from '@libs/CurrencyUtils'; import DistanceRequestUtils from '@libs/DistanceRequestUtils'; import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID'; -import {getReportIDForExpense} from '@libs/MergeTransactionUtils'; import {hasEnabledOptions} from '@libs/OptionsListUtils'; import Parser from '@libs/Parser'; import {getLengthOfTag, getTagLists, hasDependentTags as hasDependentTagsPolicyUtils, isTaxTrackingEnabled} from '@libs/PolicyUtils'; @@ -44,7 +43,6 @@ import { canEditMoneyRequest, canUserPerformWriteAction as canUserPerformWriteActionReportUtils, getReportName, - getReportOrDraftReport, getTransactionDetails, getTripIDFromTransactionParentReportID, isInvoiceReport, @@ -617,9 +615,9 @@ function MoneyRequestView({ ); }); - const actualParentReport = isFromMergeTransaction ? getReportOrDraftReport(getReportIDForExpense(updatedTransaction)) : parentReport; - const shouldShowReport = !!parentReportID || !!actualParentReport; - const reportCopyValue = !canEditReport ? getReportName(actualParentReport) || actualParentReport?.reportName : undefined; + const reportNameToDisplay = isFromMergeTransaction ? updatedTransaction?.reportName : getReportName(parentReport) || parentReport?.reportName; + const shouldShowReport = !!parentReportID || (isFromMergeTransaction && !!reportNameToDisplay); + const reportCopyValue = !canEditReport ? reportNameToDisplay : undefined; // In this case we want to use this value. The shouldUseNarrowLayout will always be true as this case is handled when we display ReportScreen in RHP. // eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth @@ -916,7 +914,7 @@ function MoneyRequestView({ >; + const MERGE_FIELD_TRANSLATION_KEYS = { amount: 'iou.amount', currency: 'iou.currency', @@ -325,6 +328,7 @@ function buildMergedTransactionData(targetTransaction: OnyxEntry, m created: mergeTransaction.created, modifiedCreated: mergeTransaction.created, reportID: mergeTransaction.reportID, + reportName: mergeTransaction.reportName, }; } @@ -375,7 +379,11 @@ function getDisplayValue(field: MergeFieldKey, transaction: Transaction, transla return getCommaSeparatedTagNameWithSanitizedColons(SafeString(fieldValue)); } if (field === 'reportID') { - return fieldValue === CONST.REPORT.UNREPORTED_REPORT_ID ? translate('common.none') : getReportName(getReportOrDraftReport(SafeString(fieldValue))); + if (fieldValue === CONST.REPORT.UNREPORTED_REPORT_ID) { + return translate('common.none'); + } + + return transaction?.reportName ?? getReportName(getReportOrDraftReport(SafeString(fieldValue))); } if (field === 'attendees') { return Array.isArray(fieldValue) ? getAttendeesListDisplayString(fieldValue) : ''; @@ -429,6 +437,26 @@ function buildMergeFieldsData( }); } +/** + * Build updated values for merge transaction field selection + * Handles special cases like currency for amount field, reportID + */ +function getMergeFieldUpdatedValues(transaction: OnyxEntry, field: K, fieldValue: MergeTransaction[K]): MergeTransactionUpdateValues { + const updatedValues: MergeTransactionUpdateValues = { + [field]: fieldValue, + }; + + if (field === 'amount') { + updatedValues.currency = getCurrency(transaction); + } + + if (field === 'reportID') { + updatedValues.reportName = transaction?.reportName ?? getReportName(getReportOrDraftReport(getReportIDForExpense(transaction))); + } + + return updatedValues; +} + export { getSourceTransactionFromMergeTransaction, getTargetTransactionFromMergeTransaction, @@ -445,8 +473,9 @@ export { getDisplayValue, buildMergeFieldsData, getReportIDForExpense, + getMergeFieldUpdatedValues, getMergeFieldErrorText, MERGE_FIELDS, }; -export type {MergeFieldKey, MergeFieldData}; +export type {MergeFieldKey, MergeFieldData, MergeTransactionUpdateValues}; diff --git a/src/libs/actions/MergeTransaction.ts b/src/libs/actions/MergeTransaction.ts index 5ed6505d4a65e..b77db2fbe15f5 100644 --- a/src/libs/actions/MergeTransaction.ts +++ b/src/libs/actions/MergeTransaction.ts @@ -1,11 +1,11 @@ import {deepEqual} from 'fast-equals'; import Onyx from 'react-native-onyx'; -import type {OnyxCollection, OnyxEntry, OnyxUpdate} from 'react-native-onyx'; +import type {OnyxCollection, OnyxEntry, OnyxMergeInput, OnyxUpdate} from 'react-native-onyx'; import * as API from '@libs/API'; import type {GetTransactionsForMergingParams} from '@libs/API/parameters'; import {READ_COMMANDS, WRITE_COMMANDS} from '@libs/API/types'; import {getMergeFieldValue, getTransactionThreadReportID, MERGE_FIELDS} from '@libs/MergeTransactionUtils'; -import type {MergeFieldKey} from '@libs/MergeTransactionUtils'; +import type {MergeFieldKey, MergeTransactionUpdateValues} from '@libs/MergeTransactionUtils'; import {isPaidGroupPolicy, isPolicyAdmin} from '@libs/PolicyUtils'; import {getIOUActionForReportID} from '@libs/ReportActionsUtils'; import { @@ -34,8 +34,8 @@ function setupMergeTransactionData(transactionID: string, values: Partial) { - Onyx.merge(`${ONYXKEYS.COLLECTION.MERGE_TRANSACTION}${transactionID}`, values); +function setMergeTransactionKey(transactionID: string, values: MergeTransactionUpdateValues) { + Onyx.merge(`${ONYXKEYS.COLLECTION.MERGE_TRANSACTION}${transactionID}`, values as OnyxMergeInput<`${typeof ONYXKEYS.COLLECTION.MERGE_TRANSACTION}${string}`>); } /** diff --git a/src/pages/TransactionMerge/DetailsReviewPage.tsx b/src/pages/TransactionMerge/DetailsReviewPage.tsx index 9cb243b8b6ae0..5111172fee762 100644 --- a/src/pages/TransactionMerge/DetailsReviewPage.tsx +++ b/src/pages/TransactionMerge/DetailsReviewPage.tsx @@ -19,6 +19,7 @@ import { buildMergeFieldsData, getMergeableDataAndConflictFields, getMergeFieldErrorText, + getMergeFieldUpdatedValues, getMergeFieldValue, getSourceTransactionFromMergeTransaction, getTargetTransactionFromMergeTransaction, @@ -31,7 +32,6 @@ import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavig import type {MergeTransactionNavigatorParamList} from '@libs/Navigation/types'; import {getIOUActionForTransactionID} from '@libs/ReportActionsUtils'; import {getTransactionDetails} from '@libs/ReportUtils'; -import {getCurrency} from '@libs/TransactionUtils'; import {createTransactionThreadReport, openReport} from '@userActions/Report'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; @@ -151,9 +151,10 @@ function DetailsReviewPage({route}: DetailsReviewPageProps) { // Update both the field value and track which transaction was selected (persisted in Onyx) const currentSelections = mergeTransaction?.selectedTransactionByField ?? {}; + const updatedValues = getMergeFieldUpdatedValues(transaction, field, fieldValue); + setMergeTransactionKey(transactionID, { - [field]: fieldValue, - ...(field === 'amount' && {currency: getCurrency(transaction)}), + ...updatedValues, selectedTransactionByField: { ...currentSelections, [field]: transaction.transactionID, diff --git a/src/pages/TransactionMerge/MergeTransactionsListContent.tsx b/src/pages/TransactionMerge/MergeTransactionsListContent.tsx index 5a5f51098bec3..b207c363a6716 100644 --- a/src/pages/TransactionMerge/MergeTransactionsListContent.tsx +++ b/src/pages/TransactionMerge/MergeTransactionsListContent.tsx @@ -22,9 +22,8 @@ import { shouldNavigateToReceiptReview, } from '@libs/MergeTransactionUtils'; import Navigation from '@libs/Navigation/Navigation'; -import {getReportName, getReportOrDraftReport} from '@libs/ReportUtils'; +import {getReportName} from '@libs/ReportUtils'; import {getCreated} from '@libs/TransactionUtils'; -import {openReport} from '@userActions/Report'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; @@ -115,13 +114,6 @@ function MergeTransactionsListContent({transactionID, mergeTransaction}: MergeTr return; } - // It's a temporary solution to ensure the source report is loaded, so we can display reportName in the merge transaction details page - // We plan to remove this in next phase of merge expenses project - const sourceReport = getReportOrDraftReport(sourceTransaction.reportID); - if (!sourceReport) { - openReport(sourceTransaction.reportID); - } - const {targetTransaction: newTargetTransaction, sourceTransaction: newSourceTransaction} = selectTargetAndSourceTransactionsForMerge(targetTransaction, sourceTransaction); if (shouldNavigateToReceiptReview([newTargetTransaction, newSourceTransaction])) { setMergeTransactionKey(transactionID, { diff --git a/src/types/onyx/MergeTransaction.ts b/src/types/onyx/MergeTransaction.ts index 1b6023585d9d5..1710628084e97 100644 --- a/src/types/onyx/MergeTransaction.ts +++ b/src/types/onyx/MergeTransaction.ts @@ -52,6 +52,9 @@ type MergeTransaction = { /** The report ID of the transaction */ reportID: string; + /** The report name of the transaction */ + reportName: string; + /** The attendees of the transaction */ attendees?: Attendee[]; }; diff --git a/src/types/onyx/Transaction.ts b/src/types/onyx/Transaction.ts index 0660e9604e3c4..56c77bef14a85 100644 --- a/src/types/onyx/Transaction.ts +++ b/src/types/onyx/Transaction.ts @@ -478,6 +478,9 @@ type Transaction = OnyxCommon.OnyxValueWithOfflineFeedback< /** The iouReportID associated with the transaction */ reportID: string | undefined; + /** The name of iouReport associated with the transaction */ + reportName?: string; + /** Existing routes */ routes?: Routes; diff --git a/tests/unit/MergeTransactionUtilsTest.ts b/tests/unit/MergeTransactionUtilsTest.ts index c4f0713cc9aba..8ccf37d4d9b53 100644 --- a/tests/unit/MergeTransactionUtilsTest.ts +++ b/tests/unit/MergeTransactionUtilsTest.ts @@ -1,9 +1,11 @@ +import Onyx from 'react-native-onyx'; import { buildMergedTransactionData, getDisplayValue, getMergeableDataAndConflictFields, getMergeFieldErrorText, getMergeFieldTranslationKey, + getMergeFieldUpdatedValues, getMergeFieldValue, getReceiptFileName, getSourceTransactionFromMergeTransaction, @@ -13,14 +15,22 @@ import { } from '@libs/MergeTransactionUtils'; import {getTransactionDetails} from '@libs/ReportUtils'; import CONST from '@src/CONST'; +import ONYXKEYS from '@src/ONYXKEYS'; import createRandomMergeTransaction from '../utils/collections/mergeTransaction'; +import {createRandomReport} from '../utils/collections/reports'; import createRandomTransaction from '../utils/collections/transaction'; import {translateLocal} from '../utils/TestHelper'; +import waitForBatchedUpdates from '../utils/waitForBatchedUpdates'; // Mock localeCompare function for tests const mockLocaleCompare = (a: string, b: string) => a.localeCompare(b); describe('MergeTransactionUtils', () => { + beforeAll(() => { + Onyx.init({keys: ONYXKEYS}); + return waitForBatchedUpdates(); + }); + describe('getSourceTransactionFromMergeTransaction', () => { it('should return undefined when mergeTransaction is undefined', () => { // Given a null merge transaction @@ -509,6 +519,7 @@ describe('MergeTransactionUtils', () => { receipt: {receiptID: 1235, source: 'merged.jpg', filename: 'merged.jpg'}, created: '2025-01-02T00:00:00.000Z', reportID: '1', + reportName: 'Test Report', }; const result = buildMergedTransactionData(targetTransaction, mergeTransaction); @@ -534,6 +545,7 @@ describe('MergeTransactionUtils', () => { created: '2025-01-02T00:00:00.000Z', modifiedCreated: '2025-01-02T00:00:00.000Z', reportID: '1', + reportName: 'Test Report', }); }); }); @@ -740,6 +752,114 @@ describe('MergeTransactionUtils', () => { expect(merchantResult).toBe('Starbucks Coffee'); expect(categoryResult).toBe('Food & Dining'); }); + + it('should return "None" for unreported reportID', () => { + // Given a transaction with unreported reportID + const transaction = { + ...createRandomTransaction(0), + reportID: CONST.REPORT.UNREPORTED_REPORT_ID, + }; + + // When we get display value for reportID + const result = getDisplayValue('reportID', transaction, translateLocal); + + // Then it should return translated "None" + expect(result).toBe('common.none'); + }); + + it("should return transaction's reportName when available for reportID", () => { + // Given a transaction with reportID and reportName + const transaction = { + ...createRandomTransaction(0), + reportID: '123', + reportName: 'Test Report Name', + }; + + // When we get display value for reportID + const result = getDisplayValue('reportID', transaction, translateLocal); + + // Then it should return the reportName + expect(result).toBe('Test Report Name'); + }); + + it("should return report's name when no reportName available on transaction", async () => { + // Given a random report + const reportID = 456; + const report = { + ...createRandomReport(reportID, undefined), + reportName: 'Test Report Name', + }; + + // Store the report in Onyx + await Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, report); + await waitForBatchedUpdates(); + + // Given a transaction with reportID but no reportName + const transaction = { + ...createRandomTransaction(0), + reportID: report.reportID, + reportName: undefined, + }; + + // When we get display value for reportID + const result = getDisplayValue('reportID', transaction, translateLocal); + + // Then it should return the report's name from Onyx + expect(result).toBe(report.reportName); + }); + }); + + describe('getMergeFieldUpdatedValues', () => { + it('should return updated values with the field value for non-special fields', () => { + // Given a transaction and a basic field like merchant + const transaction = createRandomTransaction(0); + const fieldValue = 'New Merchant Name'; + + // When we get updated values for merchant field + const result = getMergeFieldUpdatedValues(transaction, 'merchant', fieldValue); + + // Then it should return an object with the field value + expect(result).toEqual({ + merchant: 'New Merchant Name', + }); + }); + + it('should include currency when field is amount', () => { + // Given a transaction with EUR currency + const transaction = { + ...createRandomTransaction(0), + currency: CONST.CURRENCY.EUR, + }; + const fieldValue = 2500; + + // When we get updated values for amount field + const result = getMergeFieldUpdatedValues(transaction, 'amount', fieldValue); + + // Then it should include both amount and currency + expect(result).toEqual({ + amount: 2500, + currency: CONST.CURRENCY.EUR, + }); + }); + + it('should include reportName when field is reportID', () => { + // Given a transaction with a reportID and reportName + const transaction = { + ...createRandomTransaction(0), + reportID: '123', + reportName: 'Test Report', + }; + const fieldValue = '456'; + + // When we get updated values for reportID field + const result = getMergeFieldUpdatedValues(transaction, 'reportID', fieldValue); + + // Then it should include both reportID and reportName + expect(result).toEqual({ + reportID: '456', + reportName: 'Test Report', + }); + }); }); describe('getMergeFieldErrorText', () => { diff --git a/tests/utils/collections/mergeTransaction.ts b/tests/utils/collections/mergeTransaction.ts index dd45e28fa951b..938720a013235 100644 --- a/tests/utils/collections/mergeTransaction.ts +++ b/tests/utils/collections/mergeTransaction.ts @@ -23,5 +23,6 @@ export default function createRandomMergeTransaction(index: number): MergeTransa receipt: {}, created: format(randPastDate(), CONST.DATE.FNS_DB_FORMAT_STRING), reportID: index.toString(), + reportName: randWord(), }; } From 2a8e30a58db791565d81ebff82d165fbb373b3cc Mon Sep 17 00:00:00 2001 From: VH Date: Thu, 6 Nov 2025 16:24:05 +0700 Subject: [PATCH 2/3] Auto-populate reportName when reportID auto-merges --- src/libs/MergeTransactionUtils.ts | 43 +++++++++++++------------ tests/unit/MergeTransactionUtilsTest.ts | 21 ++++++++++++ 2 files changed, 43 insertions(+), 21 deletions(-) diff --git a/src/libs/MergeTransactionUtils.ts b/src/libs/MergeTransactionUtils.ts index d56524cbd84cf..94b8d39801a5d 100644 --- a/src/libs/MergeTransactionUtils.ts +++ b/src/libs/MergeTransactionUtils.ts @@ -175,6 +175,26 @@ function getMergeFieldTranslationKey(field: MergeFieldKey) { return MERGE_FIELD_TRANSLATION_KEYS[field]; } +/** + * Build updated values for merge transaction field selection + * Handles special cases like currency for amount field, reportID + */ +function getMergeFieldUpdatedValues(transaction: OnyxEntry, field: K, fieldValue: MergeTransaction[K]): MergeTransactionUpdateValues { + const updatedValues: MergeTransactionUpdateValues = { + [field]: fieldValue, + }; + + if (field === 'amount') { + updatedValues.currency = getCurrency(transaction); + } + + if (field === 'reportID') { + updatedValues.reportName = transaction?.reportName ?? getReportName(getReportOrDraftReport(getReportIDForExpense(transaction))); + } + + return updatedValues; +} + /** * Get mergeableData data if one is missing, and conflict fields that need to be resolved by the user * @param targetTransaction - The target transaction @@ -233,7 +253,8 @@ function getMergeableDataAndConflictFields(targetTransaction: OnyxEntry(transaction: OnyxEntry, field: K, fieldValue: MergeTransaction[K]): MergeTransactionUpdateValues { - const updatedValues: MergeTransactionUpdateValues = { - [field]: fieldValue, - }; - - if (field === 'amount') { - updatedValues.currency = getCurrency(transaction); - } - - if (field === 'reportID') { - updatedValues.reportName = transaction?.reportName ?? getReportName(getReportOrDraftReport(getReportIDForExpense(transaction))); - } - - return updatedValues; -} - export { getSourceTransactionFromMergeTransaction, getTargetTransactionFromMergeTransaction, diff --git a/tests/unit/MergeTransactionUtilsTest.ts b/tests/unit/MergeTransactionUtilsTest.ts index 8ccf37d4d9b53..0b6f5ef1eb465 100644 --- a/tests/unit/MergeTransactionUtilsTest.ts +++ b/tests/unit/MergeTransactionUtilsTest.ts @@ -488,6 +488,27 @@ describe('MergeTransactionUtils', () => { expect(result.conflictFields).toContain('attendees'); }); }); + + it('auto-merges reportID and populates reportName when reportIDs match', () => { + const sharedReportID = 'R123'; + const targetTransaction = { + ...createRandomTransaction(10), + reportID: sharedReportID, + reportName: 'Shared Report Name', + }; + const sourceTransaction = { + ...createRandomTransaction(11), + reportID: sharedReportID, + }; + + const result = getMergeableDataAndConflictFields(targetTransaction, sourceTransaction, mockLocaleCompare); + + expect(result.conflictFields).not.toContain('reportID'); + expect(result.mergeableData).toMatchObject({ + reportID: sharedReportID, + reportName: 'Shared Report Name', + }); + }); }); describe('buildMergedTransactionData', () => { From ccad2467f5ebefa3fa75846c8a7e9c8b67b5c932 Mon Sep 17 00:00:00 2001 From: VH Date: Wed, 19 Nov 2025 08:49:22 +0700 Subject: [PATCH 3/3] Fix merge conflicts --- src/libs/MergeTransactionUtils.ts | 25 +++--------------- tests/unit/MergeTransactionUtilsTest.ts | 34 ------------------------- 2 files changed, 4 insertions(+), 55 deletions(-) diff --git a/src/libs/MergeTransactionUtils.ts b/src/libs/MergeTransactionUtils.ts index 61e1853c02dfa..7b50599e88945 100644 --- a/src/libs/MergeTransactionUtils.ts +++ b/src/libs/MergeTransactionUtils.ts @@ -186,26 +186,6 @@ function getMergeFields(targetTransaction: OnyxEntry) { return MERGE_FIELDS.filter((field) => !excludeFields.includes(field)); } -/** - * Build updated values for merge transaction field selection - * Handles special cases like currency for amount field, reportID - */ -function getMergeFieldUpdatedValues(transaction: OnyxEntry, field: K, fieldValue: MergeTransaction[K]): MergeTransactionUpdateValues { - const updatedValues: MergeTransactionUpdateValues = { - [field]: fieldValue, - }; - - if (field === 'amount') { - updatedValues.currency = getCurrency(transaction); - } - - if (field === 'reportID') { - updatedValues.reportName = transaction?.reportName ?? getReportName(getReportOrDraftReport(getReportIDForExpense(transaction))); - } - - return updatedValues; -} - /** * Get mergeableData data if one is missing, and conflict fields that need to be resolved by the user * @param targetTransaction - The target transaction @@ -483,6 +463,10 @@ function getMergeFieldUpdatedValues(transaction: OnyxEn updatedValues.currency = getCurrency(transaction); } + if (field === 'reportID') { + updatedValues.reportName = transaction?.reportName ?? getReportName(getReportOrDraftReport(getReportIDForExpense(transaction))); + } + if (field === 'merchant' && isDistanceRequest(transaction)) { const transactionDetails = getTransactionDetails(transaction); updatedValues.amount = getMergeFieldValue(transactionDetails, transaction, 'amount') as number; @@ -522,7 +506,6 @@ export { getDisplayValue, buildMergeFieldsData, getReportIDForExpense, - getMergeFieldUpdatedValues, getMergeFieldErrorText, MERGE_FIELDS, getRateFromMerchant, diff --git a/tests/unit/MergeTransactionUtilsTest.ts b/tests/unit/MergeTransactionUtilsTest.ts index fe6a8a3500fcb..dd093a3ff85a0 100644 --- a/tests/unit/MergeTransactionUtilsTest.ts +++ b/tests/unit/MergeTransactionUtilsTest.ts @@ -891,40 +891,6 @@ describe('MergeTransactionUtils', () => { reportName: 'Test Report', }); }); - }); - - describe('getMergeFieldUpdatedValues', () => { - it('should return updated values with the field value for non-special fields', () => { - // Given a transaction and a basic field like merchant - const transaction = createRandomTransaction(0); - const fieldValue = 'New Merchant Name'; - - // When we get updated values for merchant field - const result = getMergeFieldUpdatedValues(transaction, 'merchant', fieldValue); - - // Then it should return an object with the field value - expect(result).toEqual({ - merchant: 'New Merchant Name', - }); - }); - - it('should include currency when field is amount', () => { - // Given a transaction with EUR currency - const transaction = { - ...createRandomTransaction(0), - currency: CONST.CURRENCY.EUR, - }; - const fieldValue = 2500; - - // When we get updated values for amount field - const result = getMergeFieldUpdatedValues(transaction, 'amount', fieldValue); - - // Then it should include both amount and currency - expect(result).toEqual({ - amount: 2500, - currency: CONST.CURRENCY.EUR, - }); - }); it('should include additional fields when merchant field is selected for distance request', () => { // Given a distance request transaction