@@ -349,7 +349,7 @@ describe('actions/Policy', () => {
349349 } ) ;
350350 } ) ;
351351
352- it ( 'create a new workspace with enabled workflows if the onboarding choice is newDotManageTeam or newDotLookingAround ' , async ( ) => {
352+ it ( 'create a new workspace with enabled workflows if the onboarding choice is newDotManageTeam' , async ( ) => {
353353 Onyx . merge ( `${ ONYXKEYS . NVP_INTRO_SELECTED } ` , { choice : CONST . ONBOARDING_CHOICES . MANAGE_TEAM } ) ;
354354 await waitForBatchedUpdates ( ) ;
355355
@@ -368,12 +368,69 @@ describe('actions/Policy', () => {
368368 } ) ;
369369 } ) ;
370370
371- it ( 'create a new workspace with disabled workflows if the onboarding choice is not newDotManageTeam or newDotLookingAround' , async ( ) => {
372- Onyx . merge ( `${ ONYXKEYS . NVP_INTRO_SELECTED } ` , { choice : CONST . ONBOARDING_CHOICES . PERSONAL_SPEND } ) ;
371+ it ( 'create a new workspace with enabled workflows if the onboarding choice is newDotLookingAround' , async ( ) => {
372+ Onyx . merge ( `${ ONYXKEYS . NVP_INTRO_SELECTED } ` , { choice : CONST . ONBOARDING_CHOICES . LOOKING_AROUND } ) ;
373373 await waitForBatchedUpdates ( ) ;
374374
375375 const policyID = Policy . generatePolicyID ( ) ;
376- // When a new workspace is created with introSelected set to PERSONAL_SPEND
376+ // When a new workspace is created with introSelected set to LOOKING_AROUND
377+ Policy . createWorkspace ( ESH_EMAIL , true , WORKSPACE_NAME , policyID ) ;
378+ await waitForBatchedUpdates ( ) ;
379+
380+ await TestHelper . getOnyxData ( {
381+ key : `${ ONYXKEYS . COLLECTION . POLICY } ${ policyID } ` ,
382+ waitForCollectionCallback : false ,
383+ callback : ( policy ) => {
384+ // Then the workflows feature is enabled
385+ expect ( policy ?. areWorkflowsEnabled ) . toBeTruthy ( ) ;
386+ } ,
387+ } ) ;
388+ } ) ;
389+
390+ it ( 'create a new workspace with disabled workflows if the onboarding choice is newDotTrackWorkspace' , async ( ) => {
391+ Onyx . merge ( `${ ONYXKEYS . NVP_INTRO_SELECTED } ` , { choice : CONST . ONBOARDING_CHOICES . TRACK_WORKSPACE } ) ;
392+ await waitForBatchedUpdates ( ) ;
393+
394+ const policyID = Policy . generatePolicyID ( ) ;
395+ // When a new workspace is created with introSelected set to TRACK_WORKSPACE
396+ Policy . createWorkspace ( ESH_EMAIL , true , WORKSPACE_NAME , policyID ) ;
397+ await waitForBatchedUpdates ( ) ;
398+
399+ await TestHelper . getOnyxData ( {
400+ key : `${ ONYXKEYS . COLLECTION . POLICY } ${ policyID } ` ,
401+ waitForCollectionCallback : false ,
402+ callback : ( policy ) => {
403+ // Then workflows are not enabled
404+ expect ( policy ?. areWorkflowsEnabled ) . toBeFalsy ( ) ;
405+ } ,
406+ } ) ;
407+ } ) ;
408+
409+ it ( 'create a new workspace with disabled workflows if the onboarding choice is newDotEmployer' , async ( ) => {
410+ Onyx . merge ( `${ ONYXKEYS . NVP_INTRO_SELECTED } ` , { choice : CONST . ONBOARDING_CHOICES . EMPLOYER } ) ;
411+ await waitForBatchedUpdates ( ) ;
412+
413+ const policyID = Policy . generatePolicyID ( ) ;
414+ // When a new workspace is created with introSelected set to EMPLOYER
415+ Policy . createWorkspace ( ESH_EMAIL , true , WORKSPACE_NAME , policyID ) ;
416+ await waitForBatchedUpdates ( ) ;
417+
418+ await TestHelper . getOnyxData ( {
419+ key : `${ ONYXKEYS . COLLECTION . POLICY } ${ policyID } ` ,
420+ waitForCollectionCallback : false ,
421+ callback : ( policy ) => {
422+ // Then workflows are not enabled
423+ expect ( policy ?. areWorkflowsEnabled ) . toBeFalsy ( ) ;
424+ } ,
425+ } ) ;
426+ } ) ;
427+
428+ it ( 'create a new workspace with disabled workflows if the onboarding choice is newDotSplitChat' , async ( ) => {
429+ Onyx . merge ( `${ ONYXKEYS . NVP_INTRO_SELECTED } ` , { choice : CONST . ONBOARDING_CHOICES . CHAT_SPLIT } ) ;
430+ await waitForBatchedUpdates ( ) ;
431+
432+ const policyID = Policy . generatePolicyID ( ) ;
433+ // When a new workspace is created with introSelected set to CHAT_SPLIT
377434 Policy . createWorkspace ( ESH_EMAIL , true , WORKSPACE_NAME , policyID ) ;
378435 await waitForBatchedUpdates ( ) ;
379436
0 commit comments