@@ -1285,6 +1285,7 @@ describe('getSecondaryAction', () => {
12851285 const policy = { } as unknown as Policy ;
12861286
12871287 jest . spyOn ( ReportUtils , 'canHoldUnholdReportAction' ) . mockReturnValueOnce ( { canHoldRequest : true , canUnholdRequest : true } ) ;
1288+ jest . spyOn ( ReportUtils , 'isAwaitingFirstLevelApproval' ) . mockReturnValueOnce ( true ) ;
12881289 jest . spyOn ( ReportActionsUtils , 'getOneTransactionThreadReportID' ) . mockReturnValueOnce ( originalMessageR14932 . IOUTransactionID ) ;
12891290 const result = getSecondaryReportActions ( {
12901291 currentUserLogin : EMPLOYEE_EMAIL ,
@@ -1301,6 +1302,39 @@ describe('getSecondaryAction', () => {
13011302 expect ( result . includes ( CONST . REPORT . SECONDARY_ACTIONS . HOLD ) ) . toBe ( true ) ;
13021303 } ) ;
13031304
1305+ it ( 'does not include HOLD option for submitter after first approval' , ( ) => {
1306+ const report = {
1307+ reportID : REPORT_ID ,
1308+ type : CONST . REPORT . TYPE . EXPENSE ,
1309+ ownerAccountID : EMPLOYEE_ACCOUNT_ID ,
1310+ stateNum : CONST . REPORT . STATE_NUM . SUBMITTED ,
1311+ statusNum : CONST . REPORT . STATUS_NUM . SUBMITTED ,
1312+ } as unknown as Report ;
1313+
1314+ const transaction = {
1315+ transactionID : 'TRANSACTION_ID_R14932' ,
1316+ comment : { } ,
1317+ } as unknown as Transaction ;
1318+ const policy = { } as unknown as Policy ;
1319+
1320+ jest . spyOn ( ReportUtils , 'canHoldUnholdReportAction' ) . mockReturnValueOnce ( { canHoldRequest : true , canUnholdRequest : true } ) ;
1321+ jest . spyOn ( ReportUtils , 'isAwaitingFirstLevelApproval' ) . mockReturnValueOnce ( false ) ;
1322+ jest . spyOn ( ReportActionsUtils , 'getOneTransactionThreadReportID' ) . mockReturnValueOnce ( originalMessageR14932 . IOUTransactionID ) ;
1323+ const result = getSecondaryReportActions ( {
1324+ currentUserLogin : EMPLOYEE_EMAIL ,
1325+ currentUserAccountID : EMPLOYEE_ACCOUNT_ID ,
1326+ report,
1327+ chatReport,
1328+ reportTransactions : [ transaction ] ,
1329+ originalTransaction : { } as Transaction ,
1330+ violations : { } ,
1331+ bankAccountList : { } ,
1332+ policy,
1333+ reportActions : [ actionR14932 ] ,
1334+ } ) ;
1335+ expect ( result . includes ( CONST . REPORT . SECONDARY_ACTIONS . HOLD ) ) . toBe ( false ) ;
1336+ } ) ;
1337+
13041338 it ( 'does not include CHANGE_WORKSPACE option for submitted IOU report and manager being the payer of the new policy' , async ( ) => {
13051339 const report = {
13061340 reportID : REPORT_ID ,
@@ -2620,6 +2654,7 @@ describe('getSecondaryTransactionThreadActions', () => {
26202654 const policy = { } as unknown as Policy ;
26212655
26222656 jest . spyOn ( ReportUtils , 'canHoldUnholdReportAction' ) . mockReturnValueOnce ( { canHoldRequest : true , canUnholdRequest : true } ) ;
2657+ jest . spyOn ( ReportUtils , 'isAwaitingFirstLevelApproval' ) . mockReturnValueOnce ( true ) ;
26232658 const result = getSecondaryTransactionThreadActions ( EMPLOYEE_EMAIL , EMPLOYEE_ACCOUNT_ID , report , transaction , actionR14932 , { } as Transaction , policy ) ;
26242659 expect ( result . includes ( CONST . REPORT . SECONDARY_ACTIONS . HOLD ) ) . toBe ( true ) ;
26252660 } ) ;
0 commit comments