@@ -54,7 +54,9 @@ describe('getPrimaryAction', () => {
5454 } as unknown as Report ;
5555 await Onyx . merge ( `${ ONYXKEYS . COLLECTION . REPORT } ${ REPORT_ID } ` , report ) ;
5656
57- expect ( getReportPrimaryAction ( { report, chatReport, reportTransactions : [ ] , violations : { } , policy : { } as Policy } ) ) . toBe ( CONST . REPORT . PRIMARY_ACTIONS . ADD_EXPENSE ) ;
57+ expect ( getReportPrimaryAction ( { report, chatReport, reportTransactions : [ ] , violations : { } , policy : { } as Policy , isChatReportArchived : false } ) ) . toBe (
58+ CONST . REPORT . PRIMARY_ACTIONS . ADD_EXPENSE ,
59+ ) ;
5860 } ) ;
5961
6062 it ( 'should return SUBMIT for expense report with manual submit' , async ( ) => {
@@ -73,7 +75,9 @@ describe('getPrimaryAction', () => {
7375 reportID : `${ REPORT_ID } ` ,
7476 } as unknown as Transaction ;
7577
76- expect ( getReportPrimaryAction ( { report, chatReport, reportTransactions : [ transaction ] , violations : { } , policy : policy as Policy } ) ) . toBe ( CONST . REPORT . PRIMARY_ACTIONS . SUBMIT ) ;
78+ expect ( getReportPrimaryAction ( { report, chatReport, reportTransactions : [ transaction ] , violations : { } , policy : policy as Policy , isChatReportArchived : false } ) ) . toBe (
79+ CONST . REPORT . PRIMARY_ACTIONS . SUBMIT ,
80+ ) ;
7781 } ) ;
7882
7983 it ( 'should not return SUBMIT option for admin with only pending transactions' , async ( ) => {
@@ -97,7 +101,7 @@ describe('getPrimaryAction', () => {
97101 date : '2025-01-01' ,
98102 } as unknown as Transaction ;
99103
100- expect ( getReportPrimaryAction ( { report, chatReport, reportTransactions : [ transaction ] , violations : { } , policy : policy as Policy } ) ) . toBe ( '' ) ;
104+ expect ( getReportPrimaryAction ( { report, chatReport, reportTransactions : [ transaction ] , violations : { } , policy : policy as Policy , isChatReportArchived : false } ) ) . toBe ( '' ) ;
101105 } ) ;
102106
103107 it ( 'should return Approve for report being processed' , async ( ) => {
@@ -121,7 +125,9 @@ describe('getPrimaryAction', () => {
121125 } ,
122126 } as unknown as Transaction ;
123127
124- expect ( getReportPrimaryAction ( { report, chatReport, reportTransactions : [ transaction ] , violations : { } , policy : policy as Policy } ) ) . toBe ( CONST . REPORT . PRIMARY_ACTIONS . APPROVE ) ;
128+ expect ( getReportPrimaryAction ( { report, chatReport, reportTransactions : [ transaction ] , violations : { } , policy : policy as Policy , isChatReportArchived : false } ) ) . toBe (
129+ CONST . REPORT . PRIMARY_ACTIONS . APPROVE ,
130+ ) ;
125131 } ) ;
126132
127133 it ( 'should return empty for report being processed but transactions are scanning' , async ( ) => {
@@ -148,7 +154,7 @@ describe('getPrimaryAction', () => {
148154 } ,
149155 } as unknown as Transaction ;
150156
151- expect ( getReportPrimaryAction ( { report, chatReport, reportTransactions : [ transaction ] , violations : { } , policy : policy as Policy } ) ) . toBe ( '' ) ;
157+ expect ( getReportPrimaryAction ( { report, chatReport, reportTransactions : [ transaction ] , violations : { } , policy : policy as Policy , isChatReportArchived : false } ) ) . toBe ( '' ) ;
152158 } ) ;
153159
154160 it ( 'should return empty for report being processed but transactions are pending' , async ( ) => {
@@ -173,7 +179,7 @@ describe('getPrimaryAction', () => {
173179 date : '2025-01-01' ,
174180 } as unknown as Transaction ;
175181
176- expect ( getReportPrimaryAction ( { report, chatReport, reportTransactions : [ transaction ] , violations : { } , policy : policy as Policy } ) ) . toBe ( '' ) ;
182+ expect ( getReportPrimaryAction ( { report, chatReport, reportTransactions : [ transaction ] , violations : { } , policy : policy as Policy , isChatReportArchived : false } ) ) . toBe ( '' ) ;
177183 } ) ;
178184
179185 it ( 'should return PAY for submitted invoice report if paid as personal' , async ( ) => {
@@ -203,7 +209,9 @@ describe('getPrimaryAction', () => {
203209 reportID : `${ REPORT_ID } ` ,
204210 } as unknown as Transaction ;
205211
206- expect ( getReportPrimaryAction ( { report, chatReport, reportTransactions : [ transaction ] , violations : { } , policy, invoiceReceiverPolicy} ) ) . toBe ( CONST . REPORT . PRIMARY_ACTIONS . PAY ) ;
212+ expect ( getReportPrimaryAction ( { report, chatReport, reportTransactions : [ transaction ] , violations : { } , policy, invoiceReceiverPolicy, isChatReportArchived : false } ) ) . toBe (
213+ CONST . REPORT . PRIMARY_ACTIONS . PAY ,
214+ ) ;
207215 } ) ;
208216
209217 it ( 'should not return PAY for zero value invoice report if paid as personal' , async ( ) => {
@@ -233,7 +241,7 @@ describe('getPrimaryAction', () => {
233241 reportID : `${ REPORT_ID } ` ,
234242 } as unknown as Transaction ;
235243
236- expect ( getReportPrimaryAction ( { report, chatReport, reportTransactions : [ transaction ] , violations : { } , policy, invoiceReceiverPolicy} ) ) . toBe ( '' ) ;
244+ expect ( getReportPrimaryAction ( { report, chatReport, reportTransactions : [ transaction ] , violations : { } , policy, invoiceReceiverPolicy, isChatReportArchived : false } ) ) . toBe ( '' ) ;
237245 } ) ;
238246
239247 it ( 'should return PAY for expense report with payments enabled' , async ( ) => {
@@ -252,7 +260,9 @@ describe('getPrimaryAction', () => {
252260 reportID : `${ REPORT_ID } ` ,
253261 } as unknown as Transaction ;
254262
255- expect ( getReportPrimaryAction ( { report, chatReport, reportTransactions : [ transaction ] , violations : { } , policy : policy as Policy } ) ) . toBe ( CONST . REPORT . PRIMARY_ACTIONS . PAY ) ;
263+ expect ( getReportPrimaryAction ( { report, chatReport, reportTransactions : [ transaction ] , violations : { } , policy : policy as Policy , isChatReportArchived : false } ) ) . toBe (
264+ CONST . REPORT . PRIMARY_ACTIONS . PAY ,
265+ ) ;
256266 } ) ;
257267
258268 it ( 'should return EXPORT TO ACCOUNTING for finished reports' , async ( ) => {
@@ -278,7 +288,7 @@ describe('getPrimaryAction', () => {
278288 reportID : `${ REPORT_ID } ` ,
279289 } as unknown as Transaction ;
280290
281- expect ( getReportPrimaryAction ( { report, chatReport, reportTransactions : [ transaction ] , violations : { } , policy : policy as Policy } ) ) . toBe (
291+ expect ( getReportPrimaryAction ( { report, chatReport, reportTransactions : [ transaction ] , violations : { } , policy : policy as Policy , isChatReportArchived : false } ) ) . toBe (
282292 CONST . REPORT . PRIMARY_ACTIONS . EXPORT_TO_ACCOUNTING ,
283293 ) ;
284294 } ) ;
@@ -306,7 +316,7 @@ describe('getPrimaryAction', () => {
306316 reportID : `${ REPORT_ID } ` ,
307317 } as unknown as Transaction ;
308318
309- expect ( getReportPrimaryAction ( { report, chatReport, reportTransactions : [ transaction ] , violations : { } , policy : policy as Policy } ) ) . not . toBe (
319+ expect ( getReportPrimaryAction ( { report, chatReport, reportTransactions : [ transaction ] , violations : { } , policy : policy as Policy , isChatReportArchived : false } ) ) . not . toBe (
310320 CONST . REPORT . PRIMARY_ACTIONS . EXPORT_TO_ACCOUNTING ,
311321 ) ;
312322 } ) ;
@@ -334,7 +344,18 @@ describe('getPrimaryAction', () => {
334344 { actionName : CONST . REPORT . ACTIONS . TYPE . EXPORTED_TO_INTEGRATION , reportActionID : '1' , created : '2025-01-01' , originalMessage : { markedManually : true } } ,
335345 ] as unknown as ReportAction [ ] ;
336346
337- expect ( getReportPrimaryAction ( { report, chatReport, reportTransactions : [ ] , violations : { } , policy : policy as Policy , reportNameValuePairs : { } , reportActions} ) ) . toBe ( '' ) ;
347+ expect (
348+ getReportPrimaryAction ( {
349+ report,
350+ chatReport,
351+ reportTransactions : [ ] ,
352+ violations : { } ,
353+ policy : policy as Policy ,
354+ reportNameValuePairs : { } ,
355+ reportActions,
356+ isChatReportArchived : false ,
357+ } ) ,
358+ ) . toBe ( '' ) ;
338359 } ) ;
339360
340361 it ( 'should return REMOVE HOLD for reports with transactions on hold' , async ( ) => {
@@ -381,7 +402,9 @@ describe('getPrimaryAction', () => {
381402 await Onyx . set ( `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ REPORT_ID } ` , { [ REPORT_ACTION_ID ] : reportAction } ) ;
382403 await Onyx . set ( `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ CHILD_REPORT_ID } ` , { [ HOLD_ACTION_ID ] : holdAction } ) ;
383404
384- expect ( getReportPrimaryAction ( { report, chatReport, reportTransactions : [ transaction ] , violations : { } , policy : policy as Policy } ) ) . toBe ( CONST . REPORT . PRIMARY_ACTIONS . REMOVE_HOLD ) ;
405+ expect ( getReportPrimaryAction ( { report, chatReport, reportTransactions : [ transaction ] , violations : { } , policy : policy as Policy , isChatReportArchived : false } ) ) . toBe (
406+ CONST . REPORT . PRIMARY_ACTIONS . REMOVE_HOLD ,
407+ ) ;
385408 } ) ;
386409
387410 it ( 'should return MARK AS CASH if has all RTER violations' , async ( ) => {
@@ -417,6 +440,7 @@ describe('getPrimaryAction', () => {
417440 reportTransactions : [ transaction ] ,
418441 violations : { [ `${ ONYXKEYS . COLLECTION . TRANSACTION_VIOLATIONS } ${ TRANSACTION_ID } ` ] : [ violation ] } ,
419442 policy : policy as Policy ,
443+ isChatReportArchived : false ,
420444 } ) ,
421445 ) . toBe ( CONST . REPORT . PRIMARY_ACTIONS . MARK_AS_CASH ) ;
422446 } ) ;
@@ -451,6 +475,7 @@ describe('getPrimaryAction', () => {
451475 reportTransactions : [ transaction ] ,
452476 violations : { [ `${ ONYXKEYS . COLLECTION . TRANSACTION_VIOLATIONS } ${ TRANSACTION_ID } ` ] : [ violation ] } ,
453477 policy : policy as Policy ,
478+ isChatReportArchived : false ,
454479 } ) ,
455480 ) . toBe ( CONST . REPORT . PRIMARY_ACTIONS . MARK_AS_CASH ) ;
456481 } ) ;
@@ -647,6 +672,7 @@ describe('getTransactionThreadPrimaryAction', () => {
647672 reportTransactions : [ transaction ] ,
648673 violations : { } ,
649674 policy : policy as Policy ,
675+ isChatReportArchived : false ,
650676 } ) ,
651677 ) . toBe ( '' ) ;
652678 } ) ;
@@ -684,6 +710,7 @@ describe('getTransactionThreadPrimaryAction', () => {
684710 violations : { } ,
685711 policy : { } as Policy ,
686712 invoiceReceiverPolicy : invoiceReceiverPolicy as Policy ,
713+ isChatReportArchived : false ,
687714 } ) ,
688715 ) . toBe ( CONST . REPORT . PRIMARY_ACTIONS . PAY ) ;
689716 } ) ;
@@ -721,6 +748,7 @@ describe('getTransactionThreadPrimaryAction', () => {
721748 violations : { } ,
722749 policy : { } as Policy ,
723750 invoiceReceiverPolicy : invoiceReceiverPolicy as Policy ,
751+ isChatReportArchived : false ,
724752 } ) ,
725753 ) . toBe ( '' ) ;
726754 } ) ;
0 commit comments