@@ -534,6 +534,81 @@ describe('getReportPreviewAction', () => {
534534 } ) ,
535535 ) . toBe ( CONST . REPORT . REPORT_PREVIEW_ACTIONS . VIEW ) ;
536536 } ) ;
537+
538+ it ( 'should return VIEW instead of APPROVE when submitter is the manager on a Submit workspace' , async ( ) => {
539+ const report = {
540+ ...createRandomReport ( REPORT_ID , undefined ) ,
541+ type : CONST . REPORT . TYPE . EXPENSE ,
542+ ownerAccountID : CURRENT_USER_ACCOUNT_ID ,
543+ stateNum : CONST . REPORT . STATE_NUM . SUBMITTED ,
544+ statusNum : CONST . REPORT . STATUS_NUM . SUBMITTED ,
545+ managerID : CURRENT_USER_ACCOUNT_ID ,
546+ isWaitingOnBankAccount : false ,
547+ } ;
548+
549+ const policy = createRandomPolicy ( 0 , CONST . POLICY . TYPE . SUBMIT ) ;
550+ policy . approvalMode = CONST . POLICY . APPROVAL_MODE . ADVANCED ;
551+ policy . preventSelfApproval = false ;
552+
553+ await Onyx . merge ( `${ ONYXKEYS . COLLECTION . REPORT } ${ REPORT_ID } ` , report ) ;
554+ const transaction = {
555+ reportID : `${ REPORT_ID } ` ,
556+ amount : 100 ,
557+ merchant : 'Test Merchant' ,
558+ created : '2025-01-01' ,
559+ } as unknown as Transaction ;
560+
561+ expect (
562+ getReportPreviewAction ( {
563+ isReportArchived : false ,
564+ currentUserAccountID : CURRENT_USER_ACCOUNT_ID ,
565+ currentUserLogin : CURRENT_USER_EMAIL ,
566+ report,
567+ policy,
568+ transactions : [ transaction ] ,
569+ bankAccountList : { } ,
570+ reportMetadata : undefined ,
571+ } ) ,
572+ ) . toBe ( CONST . REPORT . REPORT_PREVIEW_ACTIONS . VIEW ) ;
573+ } ) ;
574+
575+ it ( 'should return APPROVE when a different user is the manager on a Submit workspace' , async ( ) => {
576+ const approverAccountID = CURRENT_USER_ACCOUNT_ID + 1 ;
577+ const report = {
578+ ...createRandomReport ( REPORT_ID , undefined ) ,
579+ type : CONST . REPORT . TYPE . EXPENSE ,
580+ ownerAccountID : CURRENT_USER_ACCOUNT_ID ,
581+ stateNum : CONST . REPORT . STATE_NUM . SUBMITTED ,
582+ statusNum : CONST . REPORT . STATUS_NUM . SUBMITTED ,
583+ managerID : approverAccountID ,
584+ isWaitingOnBankAccount : false ,
585+ } ;
586+
587+ const policy = createRandomPolicy ( 0 , CONST . POLICY . TYPE . SUBMIT ) ;
588+ policy . approvalMode = CONST . POLICY . APPROVAL_MODE . ADVANCED ;
589+ policy . preventSelfApproval = false ;
590+
591+ await Onyx . merge ( `${ ONYXKEYS . COLLECTION . REPORT } ${ REPORT_ID } ` , report ) ;
592+ const transaction = {
593+ reportID : `${ REPORT_ID } ` ,
594+ amount : 100 ,
595+ merchant : 'Test Merchant' ,
596+ created : '2025-01-01' ,
597+ } as unknown as Transaction ;
598+
599+ expect (
600+ getReportPreviewAction ( {
601+ isReportArchived : false ,
602+ currentUserAccountID : approverAccountID ,
603+ currentUserLogin : 'approver@mail.com' ,
604+ report,
605+ policy,
606+ transactions : [ transaction ] ,
607+ bankAccountList : { } ,
608+ reportMetadata : undefined ,
609+ } ) ,
610+ ) . toBe ( CONST . REPORT . REPORT_PREVIEW_ACTIONS . APPROVE ) ;
611+ } ) ;
537612 } ) ;
538613
539614 it ( "canApprove should return true for the current report manager regardless of whether they're in the current approval workflow" , async ( ) => {
0 commit comments