@@ -13,6 +13,7 @@ import {
1313 cancelPayment ,
1414 canIOUBePaid ,
1515 canUnapproveIOU ,
16+ completeSplitBill ,
1617 createDistanceRequest ,
1718 deleteMoneyRequest ,
1819 getIOUReportActionToApproveOrPay ,
@@ -28,6 +29,7 @@ import {
2829 setDraftSplitTransaction ,
2930 setMoneyRequestCategory ,
3031 splitBill ,
32+ startSplitBill ,
3133 submitReport ,
3234 trackExpense ,
3335 unholdRequest ,
@@ -2315,6 +2317,63 @@ describe('actions/IOU', () => {
23152317 } ) ;
23162318 expect ( report ?. participants ?. [ RORY_ACCOUNT_ID ] . notificationPreference ) . toBe ( CONST . REPORT . NOTIFICATION_PREFERENCE . ALWAYS ) ;
23172319 } ) ;
2320+
2321+ it ( 'the description should not be parsed again after completing the scan split bill without changing the description' , async ( ) => {
2322+ const reportID = '1' ;
2323+ await Onyx . merge ( `${ ONYXKEYS . COLLECTION . REPORT } ${ reportID } ` , {
2324+ reportID,
2325+ type : CONST . REPORT . TYPE . CHAT ,
2326+ chatType : CONST . REPORT . CHAT_TYPE . GROUP ,
2327+ participants : {
2328+ [ RORY_ACCOUNT_ID ] : { notificationPreference : CONST . REPORT . NOTIFICATION_PREFERENCE . ALWAYS } ,
2329+ [ CARLOS_ACCOUNT_ID ] : { notificationPreference : CONST . REPORT . NOTIFICATION_PREFERENCE . ALWAYS } ,
2330+ } ,
2331+ } ) ;
2332+
2333+ // Start a scan split bill
2334+ const { splitTransactionID} = startSplitBill ( {
2335+ participants : [ { accountID : CARLOS_ACCOUNT_ID , login : CARLOS_EMAIL } ] ,
2336+ currentUserLogin : RORY_EMAIL ,
2337+ currentUserAccountID : RORY_ACCOUNT_ID ,
2338+ comment : '# test' ,
2339+ currency : CONST . CURRENCY . USD ,
2340+ existingSplitChatReportID : reportID ,
2341+ receipt : { } ,
2342+ category : undefined ,
2343+ tag : undefined ,
2344+ taxCode : '' ,
2345+ taxAmount : 0 ,
2346+ } ) ;
2347+
2348+ await waitForBatchedUpdates ( ) ;
2349+
2350+ let splitTransaction = await getOnyxValue ( `${ ONYXKEYS . COLLECTION . TRANSACTION } ${ splitTransactionID } ` ) ;
2351+
2352+ // Then the description should be parsed correctly
2353+ expect ( splitTransaction ?. comment ?. comment ) . toBe ( '<h1>test</h1>' ) ;
2354+
2355+ const updatedSplitTransaction = splitTransaction
2356+ ? {
2357+ ...splitTransaction ,
2358+ amount : 100 ,
2359+ }
2360+ : undefined ;
2361+
2362+ const reportActions = await getOnyxValue ( `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ reportID } ` ) ;
2363+ const iouAction = Object . values ( reportActions ?? { } ) . find ( ( action ) => isActionOfType ( action , CONST . REPORT . ACTIONS . TYPE . IOU ) ) ;
2364+
2365+ expect ( iouAction ) . toBeTruthy ( ) ;
2366+
2367+ // Complete this split bill without changing the description
2368+ completeSplitBill ( reportID , iouAction , updatedSplitTransaction , RORY_ACCOUNT_ID , RORY_EMAIL ) ;
2369+
2370+ await waitForBatchedUpdates ( ) ;
2371+
2372+ splitTransaction = await getOnyxValue ( `${ ONYXKEYS . COLLECTION . TRANSACTION } ${ splitTransactionID } ` ) ;
2373+
2374+ // Then the description should be the same since it was not changed
2375+ expect ( splitTransaction ?. comment ?. comment ) . toBe ( '<h1>test</h1>' ) ;
2376+ } ) ;
23182377 } ) ;
23192378
23202379 describe ( 'saveSplitTransactions' , ( ) => {
0 commit comments