@@ -482,6 +482,130 @@ describe('PureReportActionItem', () => {
482482 expect ( screen . getByText ( translateLocal ( 'iou.submitted' ) ) ) . toBeOnTheScreen ( ) ;
483483 expect ( screen . queryByText ( translateLocal ( 'iou.queuedToSubmitViaDEW' ) ) ) . not . toBeOnTheScreen ( ) ;
484484 } ) ;
485+
486+ it ( 'should display DEW queued message for pending APPROVED action when policy has DEW enabled' , async ( ) => {
487+ const action = createReportAction ( CONST . REPORT . ACTIONS . TYPE . APPROVED , { automaticAction : false } ) ;
488+ action . pendingAction = CONST . RED_BRICK_ROAD_PENDING_ACTION . ADD ;
489+
490+ const dewPolicy = {
491+ id : 'testPolicy' ,
492+ name : 'Test DEW Policy' ,
493+ type : CONST . POLICY . TYPE . TEAM ,
494+ role : CONST . POLICY . ROLE . ADMIN ,
495+ owner : 'owner@test.com' ,
496+ outputCurrency : CONST . CURRENCY . USD ,
497+ isPolicyExpenseChatEnabled : true ,
498+ approvalMode : CONST . POLICY . APPROVAL_MODE . DYNAMICEXTERNAL ,
499+ } as const ;
500+
501+ const reportMetadata = {
502+ pendingExpenseAction : CONST . EXPENSE_PENDING_ACTION . APPROVE ,
503+ } ;
504+
505+ await act ( async ( ) => {
506+ await Onyx . merge ( `${ ONYXKEYS . COLLECTION . POLICY } testPolicy` , dewPolicy ) ;
507+ } ) ;
508+ await waitForBatchedUpdatesWithAct ( ) ;
509+
510+ render (
511+ < ComposeProviders components = { [ OnyxListItemProvider , LocaleContextProvider , HTMLEngineProvider ] } >
512+ < OptionsListContextProvider >
513+ < ScreenWrapper testID = "test" >
514+ < PortalProvider >
515+ < PureReportActionItem
516+ personalPolicyID = { undefined }
517+ currentUserEmail = { undefined }
518+ policy = { dewPolicy as Policy }
519+ report = { { reportID : 'testReport' , policyID : 'testPolicy' } }
520+ parentReportAction = { undefined }
521+ action = { action }
522+ displayAsGroup = { false }
523+ shouldDisplayNewMarker = { false }
524+ index = { 0 }
525+ isFirstVisibleReportAction = { false }
526+ taskReport = { undefined }
527+ linkedReport = { undefined }
528+ iouReportOfLinkedReport = { undefined }
529+ reportMetadata = { reportMetadata }
530+ currentUserAccountID = { ACTOR_ACCOUNT_ID }
531+ betas = { undefined }
532+ draftTransactionIDs = { [ ] }
533+ userBillingGracePeriodEnds = { undefined }
534+ />
535+ </ PortalProvider >
536+ </ ScreenWrapper >
537+ </ OptionsListContextProvider >
538+ </ ComposeProviders > ,
539+ ) ;
540+ await waitForBatchedUpdatesWithAct ( ) ;
541+
542+ expect ( screen . getByText ( actorEmail ) ) . toBeOnTheScreen ( ) ;
543+ expect ( screen . getByText ( translateLocal ( 'iou.queuedToApproveViaDEW' ) ) ) . toBeOnTheScreen ( ) ;
544+ } ) ;
545+
546+ it ( 'should display submitted without memo for SUBMITTED action on DEW policy that is not pending' , async ( ) => {
547+ const action = createReportAction ( CONST . REPORT . ACTIONS . TYPE . SUBMITTED , { harvesting : false , message : 'my memo' } ) ;
548+
549+ const dewPolicy = {
550+ id : 'testPolicy' ,
551+ name : 'Test DEW Policy' ,
552+ type : CONST . POLICY . TYPE . TEAM ,
553+ role : CONST . POLICY . ROLE . ADMIN ,
554+ owner : 'owner@test.com' ,
555+ outputCurrency : CONST . CURRENCY . USD ,
556+ isPolicyExpenseChatEnabled : true ,
557+ approvalMode : CONST . POLICY . APPROVAL_MODE . DYNAMICEXTERNAL ,
558+ } as const ;
559+
560+ await act ( async ( ) => {
561+ await Onyx . merge ( `${ ONYXKEYS . COLLECTION . POLICY } testPolicy` , dewPolicy ) ;
562+ } ) ;
563+ await waitForBatchedUpdatesWithAct ( ) ;
564+
565+ render (
566+ < ComposeProviders components = { [ OnyxListItemProvider , LocaleContextProvider , HTMLEngineProvider ] } >
567+ < OptionsListContextProvider >
568+ < ScreenWrapper testID = "test" >
569+ < PortalProvider >
570+ < PureReportActionItem
571+ personalPolicyID = { undefined }
572+ currentUserEmail = { undefined }
573+ policy = { dewPolicy as Policy }
574+ report = { { reportID : 'testReport' , policyID : 'testPolicy' } }
575+ parentReportAction = { undefined }
576+ action = { action }
577+ displayAsGroup = { false }
578+ shouldDisplayNewMarker = { false }
579+ index = { 0 }
580+ isFirstVisibleReportAction = { false }
581+ taskReport = { undefined }
582+ linkedReport = { undefined }
583+ iouReportOfLinkedReport = { undefined }
584+ currentUserAccountID = { ACTOR_ACCOUNT_ID }
585+ betas = { undefined }
586+ draftTransactionIDs = { [ ] }
587+ userBillingGracePeriodEnds = { undefined }
588+ />
589+ </ PortalProvider >
590+ </ ScreenWrapper >
591+ </ OptionsListContextProvider >
592+ </ ComposeProviders > ,
593+ ) ;
594+ await waitForBatchedUpdatesWithAct ( ) ;
595+
596+ expect ( screen . getByText ( actorEmail ) ) . toBeOnTheScreen ( ) ;
597+ // DEW policy should show submitted without the memo (memo is shown in the Concierge action)
598+ expect ( screen . getByText ( translateLocal ( 'iou.submitted' ) ) ) . toBeOnTheScreen ( ) ;
599+ expect ( screen . queryByText ( 'my memo' ) ) . not . toBeOnTheScreen ( ) ;
600+ } ) ;
601+
602+ it ( 'CLOSED action with amount (MARK_AS_CLOSED) renders submitted message' , async ( ) => {
603+ const action = createReportAction ( CONST . REPORT . ACTIONS . TYPE . CLOSED , { amount : 5000 } ) ;
604+ renderItemWithAction ( action ) ;
605+ await waitForBatchedUpdatesWithAct ( ) ;
606+
607+ expect ( screen . getByText ( translateLocal ( 'iou.submitted' ) ) ) . toBeOnTheScreen ( ) ;
608+ } ) ;
485609 } ) ;
486610
487611 describe ( 'Followup list buttons' , ( ) => {
0 commit comments