@@ -604,24 +604,24 @@ describe('actions/IOU/Hold', () => {
604604 } )
605605 : undefined ;
606606
607- const onyxData : Record < string , unknown > = {
607+ const reportCollection : ReportCollectionDataSet = {
608608 [ `${ ONYXKEYS . COLLECTION . REPORT } ${ iouReport . reportID } ` ] : iouReport ,
609609 [ `${ ONYXKEYS . COLLECTION . REPORT } ${ chatReport . reportID } ` ] : chatReport ,
610610 } ;
611- if ( heldTransaction ) {
612- onyxData [ ` ${ ONYXKEYS . COLLECTION . TRANSACTION } ${ heldTransaction . transactionID } ` ] = heldTransaction ;
613- }
614- if ( heldIouAction ) {
615- onyxData [ ` ${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ iouReport . reportID } ` ] = {
616- [ heldIouAction . reportActionID ] : heldIouAction ,
617- } ;
618- }
619-
620- return { chatReport, iouReport, onyxData } ;
611+ const transactionCollection : TransactionCollectionDataSet = heldTransaction ? { [ ` ${ ONYXKEYS . COLLECTION . TRANSACTION } ${ heldTransaction . transactionID } ` ] : heldTransaction } : { } ;
612+ const actionCollection : ReportActionsCollectionDataSet = heldIouAction
613+ ? {
614+ [ ` ${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ iouReport . reportID } ` ] : {
615+ [ heldIouAction . reportActionID ] : heldIouAction ,
616+ } ,
617+ }
618+ : { } ;
619+
620+ return { chatReport, iouReport, reportCollection , transactionCollection , actionCollection } ;
621621 } ;
622622
623623 test ( 'should optimistically update original report total to unheldTotal when held transactions are moved out' , ( ) => {
624- const { chatReport, iouReport, onyxData } = buildScenario ( {
624+ const { chatReport, iouReport, reportCollection , transactionCollection , actionCollection } = buildScenario ( {
625625 total : 300 ,
626626 nonReimbursableTotal : 50 ,
627627 unheldTotal : 200 ,
@@ -630,7 +630,7 @@ describe('actions/IOU/Hold', () => {
630630 } ) ;
631631
632632 return waitForBatchedUpdates ( )
633- . then ( ( ) => Onyx . multiSet ( onyxData ) )
633+ . then ( ( ) => Onyx . multiSet ( { ... reportCollection , ... transactionCollection , ... actionCollection } ) )
634634 . then ( ( ) => {
635635 const result = getReportFromHoldRequestsOnyxData ( {
636636 chatReport,
@@ -646,7 +646,7 @@ describe('actions/IOU/Hold', () => {
646646 } ) ;
647647
648648 test ( 'should include matching failureData entry to restore original totals on rollback' , ( ) => {
649- const { chatReport, iouReport, onyxData } = buildScenario ( {
649+ const { chatReport, iouReport, reportCollection , transactionCollection , actionCollection } = buildScenario ( {
650650 total : 300 ,
651651 nonReimbursableTotal : 50 ,
652652 unheldTotal : 200 ,
@@ -655,7 +655,7 @@ describe('actions/IOU/Hold', () => {
655655 } ) ;
656656
657657 return waitForBatchedUpdates ( )
658- . then ( ( ) => Onyx . multiSet ( onyxData ) )
658+ . then ( ( ) => Onyx . multiSet ( { ... reportCollection , ... transactionCollection , ... actionCollection } ) )
659659 . then ( ( ) => {
660660 const result = getReportFromHoldRequestsOnyxData ( {
661661 chatReport,
@@ -676,7 +676,7 @@ describe('actions/IOU/Hold', () => {
676676 } ) ;
677677
678678 test ( 'should not push a totals update when no held transactions exist' , ( ) => {
679- const { chatReport, iouReport, onyxData } = buildScenario ( {
679+ const { chatReport, iouReport, reportCollection , transactionCollection , actionCollection } = buildScenario ( {
680680 total : 300 ,
681681 nonReimbursableTotal : 50 ,
682682 unheldTotal : 300 ,
@@ -685,7 +685,7 @@ describe('actions/IOU/Hold', () => {
685685 } ) ;
686686
687687 return waitForBatchedUpdates ( )
688- . then ( ( ) => Onyx . multiSet ( onyxData ) )
688+ . then ( ( ) => Onyx . multiSet ( { ... reportCollection , ... transactionCollection , ... actionCollection } ) )
689689 . then ( ( ) => {
690690 const result = getReportFromHoldRequestsOnyxData ( {
691691 chatReport,
@@ -703,7 +703,7 @@ describe('actions/IOU/Hold', () => {
703703 } ) ;
704704
705705 test ( 'should not push a totals update when iouReport.unheldTotal is undefined' , ( ) => {
706- const { chatReport, iouReport, onyxData } = buildScenario ( {
706+ const { chatReport, iouReport, reportCollection , transactionCollection , actionCollection } = buildScenario ( {
707707 total : 300 ,
708708 nonReimbursableTotal : 50 ,
709709 unheldTotal : undefined ,
@@ -712,7 +712,7 @@ describe('actions/IOU/Hold', () => {
712712 } ) ;
713713
714714 return waitForBatchedUpdates ( )
715- . then ( ( ) => Onyx . multiSet ( onyxData ) )
715+ . then ( ( ) => Onyx . multiSet ( { ... reportCollection , ... transactionCollection , ... actionCollection } ) )
716716 . then ( ( ) => {
717717 const result = getReportFromHoldRequestsOnyxData ( {
718718 chatReport,
0 commit comments