@@ -86,116 +86,6 @@ describe('getPrimaryAction', () => {
8686 ) . toBe ( '' ) ;
8787 } ) ;
8888
89- it ( 'should return empty string when all transactions are pending delete' , async ( ) => {
90- const report = {
91- reportID : REPORT_ID ,
92- type : CONST . REPORT . TYPE . EXPENSE ,
93- ownerAccountID : CURRENT_USER_ACCOUNT_ID ,
94- stateNum : CONST . REPORT . STATE_NUM . OPEN ,
95- statusNum : CONST . REPORT . STATUS_NUM . OPEN ,
96- } as unknown as Report ;
97- await Onyx . merge ( `${ ONYXKEYS . COLLECTION . REPORT } ${ REPORT_ID } ` , report ) ;
98- const policy = {
99- autoReportingFrequency : CONST . POLICY . AUTO_REPORTING_FREQUENCIES . IMMEDIATE ,
100- } ;
101- // When all transactions are pending delete, passing an empty filtered array should return ''
102- expect (
103- getReportPrimaryAction ( {
104- currentUserLogin : CURRENT_USER_EMAIL ,
105- currentUserAccountID : CURRENT_USER_ACCOUNT_ID ,
106- report,
107- chatReport,
108- reportTransactions : [ ] ,
109- violations : { } ,
110- bankAccountList : { } ,
111- policy : policy as Policy ,
112- isChatReportArchived : false ,
113- } ) ,
114- ) . toBe ( '' ) ;
115-
116- // Confirm the same report would return SUBMIT if non-pending-delete transactions are present
117- const normalTransaction = {
118- reportID : `${ REPORT_ID } ` ,
119- } as unknown as Transaction ;
120- expect (
121- getReportPrimaryAction ( {
122- currentUserLogin : CURRENT_USER_EMAIL ,
123- currentUserAccountID : CURRENT_USER_ACCOUNT_ID ,
124- report,
125- chatReport,
126- reportTransactions : [ normalTransaction ] ,
127- violations : { } ,
128- bankAccountList : { } ,
129- policy : policy as Policy ,
130- isChatReportArchived : false ,
131- } ) ,
132- ) . toBe ( CONST . REPORT . PRIMARY_ACTIONS . SUBMIT ) ;
133- } ) ;
134-
135- it ( 'should return SUBMIT when only non-pending-delete transactions remain after filtering' , async ( ) => {
136- const report = {
137- reportID : REPORT_ID ,
138- type : CONST . REPORT . TYPE . EXPENSE ,
139- ownerAccountID : CURRENT_USER_ACCOUNT_ID ,
140- stateNum : CONST . REPORT . STATE_NUM . OPEN ,
141- statusNum : CONST . REPORT . STATUS_NUM . OPEN ,
142- } as unknown as Report ;
143- await Onyx . merge ( `${ ONYXKEYS . COLLECTION . REPORT } ${ REPORT_ID } ` , report ) ;
144- const policy = {
145- autoReportingFrequency : CONST . POLICY . AUTO_REPORTING_FREQUENCIES . IMMEDIATE ,
146- } ;
147-
148- // Simulate the filtering that MoneyReportHeader does: only non-pending-delete transactions are passed
149- const normalTransaction = {
150- reportID : `${ REPORT_ID } ` ,
151- } as unknown as Transaction ;
152-
153- expect (
154- getReportPrimaryAction ( {
155- currentUserLogin : CURRENT_USER_EMAIL ,
156- currentUserAccountID : CURRENT_USER_ACCOUNT_ID ,
157- report,
158- chatReport,
159- reportTransactions : [ normalTransaction ] ,
160- violations : { } ,
161- bankAccountList : { } ,
162- policy : policy as Policy ,
163- isChatReportArchived : false ,
164- } ) ,
165- ) . toBe ( CONST . REPORT . PRIMARY_ACTIONS . SUBMIT ) ;
166- } ) ;
167-
168- it ( 'should return empty string for approve-eligible report when all transactions are pending delete' , async ( ) => {
169- const report = {
170- reportID : REPORT_ID ,
171- type : CONST . REPORT . TYPE . EXPENSE ,
172- ownerAccountID : CURRENT_USER_ACCOUNT_ID ,
173- stateNum : CONST . REPORT . STATE_NUM . SUBMITTED ,
174- statusNum : CONST . REPORT . STATUS_NUM . SUBMITTED ,
175- managerID : CURRENT_USER_ACCOUNT_ID ,
176- } as unknown as Report ;
177- await Onyx . merge ( `${ ONYXKEYS . COLLECTION . REPORT } ${ REPORT_ID } ` , report ) ;
178- const policy = {
179- approver : CURRENT_USER_EMAIL ,
180- approvalMode : CONST . POLICY . APPROVAL_MODE . BASIC ,
181- } ;
182-
183- // When all transactions are pending delete (filtered to empty), approve should not be available
184- expect (
185- getReportPrimaryAction ( {
186- currentUserLogin : CURRENT_USER_EMAIL ,
187- currentUserAccountID : CURRENT_USER_ACCOUNT_ID ,
188- report,
189- chatReport,
190- reportTransactions : [ ] ,
191- violations : { } ,
192- bankAccountList : { } ,
193- policy : policy as Policy ,
194- isChatReportArchived : false ,
195- } ) ,
196- ) . toBe ( '' ) ;
197- } ) ;
198-
19989 it ( 'should return SUBMIT for expense report with manual submit' , async ( ) => {
20090 const report = {
20191 reportID : REPORT_ID ,
0 commit comments