@@ -2,15 +2,10 @@ import Onyx from 'react-native-onyx';
22import OnyxUpdateManager from '@libs/actions/OnyxUpdateManager' ;
33import { startTestDrive } from '@libs/actions/Tour' ;
44import Navigation from '@libs/Navigation/Navigation' ;
5- import Parser from '@libs/Parser' ;
65import initOnyxDerivedValues from '@userActions/OnyxDerived' ;
7- import CONST from '@src/CONST' ;
86import * as SequentialQueue from '@src/libs/Network/SequentialQueue' ;
97import ONYXKEYS from '@src/ONYXKEYS' ;
108import ROUTES from '@src/ROUTES' ;
11- import type { OnboardingPurpose , Report , ReportAction } from '@src/types/onyx' ;
12- import type { ReportActionsCollectionDataSet } from '@src/types/onyx/ReportAction' ;
13- import * as LHNTestUtils from '../utils/LHNTestUtils' ;
149import * as TestHelper from '../utils/TestHelper' ;
1510import waitForBatchedUpdates from '../utils/waitForBatchedUpdates' ;
1611
@@ -36,89 +31,11 @@ describe('actions/Tour', () => {
3631 } ) ;
3732
3833 describe ( 'startTestDrive' , ( ) => {
39- describe ( 'migrated users' , ( ) => {
40- it ( 'should show the Test Drive demo if user has been nudged to migrate' , async ( ) => {
41- startTestDrive ( undefined , true , false ) ;
42- await waitForBatchedUpdates ( ) ;
34+ it ( 'should navigate to the Test Drive demo screen' , async ( ) => {
35+ startTestDrive ( ) ;
36+ await waitForBatchedUpdates ( ) ;
4337
44- expect ( Navigation . navigate ) . toHaveBeenCalledWith ( ROUTES . TEST_DRIVE_DEMO_ROOT ) ;
45- } ) ;
46-
47- it ( "should show the Test Drive demo if user doesn't have the nudge flag but is member of a paid policy" , async ( ) => {
48- startTestDrive ( undefined , false , true ) ;
49- await waitForBatchedUpdates ( ) ;
50-
51- expect ( Navigation . navigate ) . toHaveBeenCalledWith ( ROUTES . TEST_DRIVE_DEMO_ROOT ) ;
52- } ) ;
53- } ) ;
54-
55- describe ( 'NewDot users' , ( ) => {
56- const onboardingChoices = Object . values ( CONST . ONBOARDING_CHOICES ) ;
57- const onboardingDemoChoices = new Set < OnboardingPurpose > ( [
58- CONST . ONBOARDING_CHOICES . MANAGE_TEAM ,
59- CONST . ONBOARDING_CHOICES . TEST_DRIVE_RECEIVER ,
60- CONST . ONBOARDING_CHOICES . TRACK_WORKSPACE ,
61- ] ) ;
62- const accountID = 2 ;
63- const conciergeChatReport : Report = LHNTestUtils . getFakeReport ( [ accountID , CONST . ACCOUNT_ID . CONCIERGE ] ) ;
64- const testDriveTaskReport : Report = { ...LHNTestUtils . getFakeReport ( ) , ownerAccountID : accountID } ;
65-
66- let testDriveTaskAction : ReportAction ;
67- const setTestDriveTaskData = async ( ) => {
68- testDriveTaskAction = {
69- ...LHNTestUtils . getFakeReportAction ( ) ,
70- childType : CONST . REPORT . TYPE . TASK ,
71- childReportName : Parser . replace (
72- TestHelper . translateLocal ( 'onboarding.testDrive.name' , { testDriveURL : `${ CONST . STAGING_NEW_EXPENSIFY_URL } /${ ROUTES . TEST_DRIVE_DEMO_ROOT } ` } ) ,
73- ) ,
74- childReportID : testDriveTaskReport . reportID ,
75- } ;
76-
77- const reportActionsCollectionDataSet : ReportActionsCollectionDataSet = {
78- [ `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ conciergeChatReport . reportID } ` ] : {
79- [ testDriveTaskAction . reportActionID ] : testDriveTaskAction ,
80- } ,
81- } ;
82-
83- await Onyx . multiSet ( {
84- ...reportActionsCollectionDataSet ,
85- [ ONYXKEYS . SESSION ] : {
86- accountID,
87- } ,
88- } ) ;
89- } ;
90-
91- it . each ( onboardingChoices . filter ( ( choice ) => onboardingDemoChoices . has ( choice ) ) ) ( 'should show the Test Drive demo if user has "%s" onboarding choice' , async ( choice ) => {
92- await setTestDriveTaskData ( ) ;
93-
94- startTestDrive ( { choice} , false , false ) ;
95- await waitForBatchedUpdates ( ) ;
96-
97- expect ( Navigation . navigate ) . toHaveBeenCalledWith ( ROUTES . TEST_DRIVE_DEMO_ROOT ) ;
98- } ) ;
99-
100- it . each ( onboardingChoices . filter ( ( choice ) => ! onboardingDemoChoices . has ( choice ) ) ) ( 'should show the Test Drive demo if user has "%s" onboarding choice' , async ( choice ) => {
101- startTestDrive ( { choice} , false , false ) ;
102- await waitForBatchedUpdates ( ) ;
103-
104- expect ( Navigation . navigate ) . toHaveBeenCalledWith ( ROUTES . TEST_DRIVE_DEMO_ROOT ) ;
105- } ) ;
106-
107- it ( 'should show the Test Drive demo if user is an invited employee' , async ( ) => {
108- await setTestDriveTaskData ( ) ;
109-
110- startTestDrive ( { choice : CONST . ONBOARDING_CHOICES . SUBMIT , inviteType : CONST . ONBOARDING_INVITE_TYPES . WORKSPACE } , false , false ) ;
111- await waitForBatchedUpdates ( ) ;
112-
113- expect ( Navigation . navigate ) . toHaveBeenCalledWith ( ROUTES . TEST_DRIVE_DEMO_ROOT ) ;
114- } ) ;
115-
116- it ( 'should show the Test Drive demo if user is member of a paid policy' , async ( ) => {
117- startTestDrive ( { choice : CONST . ONBOARDING_CHOICES . LOOKING_AROUND } , false , true ) ;
118- await waitForBatchedUpdates ( ) ;
119-
120- expect ( Navigation . navigate ) . toHaveBeenCalledWith ( ROUTES . TEST_DRIVE_DEMO_ROOT ) ;
121- } ) ;
38+ expect ( Navigation . navigate ) . toHaveBeenCalledWith ( ROUTES . TEST_DRIVE_DEMO_ROOT ) ;
12239 } ) ;
12340 } ) ;
12441} ) ;
0 commit comments