This repository has been archived by the owner. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +28
-4
lines changed Expand file tree Collapse file tree 2 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -68,10 +68,12 @@ function commands(Cypress) {
6868 return apiClient . config ( customConfig ) ;
6969 } ;
7070
71- config ( {
72- adminApiPath : Cypress . env ( ADMIN_API_PATH_ENVIRONMENT_VAR ) ,
73- baseUrl : Cypress . env ( BASE_URL_ENVIRONMENT_VAR ) ,
74- } ) ;
71+ if ( Cypress . env ( ADMIN_API_PATH_ENVIRONMENT_VAR ) ) {
72+ config ( { adminApiPath : Cypress . env ( ADMIN_API_PATH_ENVIRONMENT_VAR ) } ) ;
73+ }
74+ if ( Cypress . env ( BASE_URL_ENVIRONMENT_VAR ) ) {
75+ config ( { baseUrl : Cypress . env ( BASE_URL_ENVIRONMENT_VAR ) } ) ;
76+ }
7577
7678 return {
7779 setBehavior,
Original file line number Diff line number Diff line change @@ -32,6 +32,28 @@ describe("commands", () => {
3232 sandbox . restore ( ) ;
3333 } ) ;
3434
35+ describe ( "when initializing" , ( ) => {
36+ it ( "should call to set adminApiPath config if env var is defined" , ( ) => {
37+ cypressMock . stubs . env . withArgs ( "MOCKS_SERVER_ADMIN_API_PATH" ) . returns ( "foo" ) ;
38+ commands ( cypressMock . stubs ) ;
39+ expect (
40+ apiClient . config . calledWith ( {
41+ adminApiPath : "foo" ,
42+ } )
43+ ) . toBe ( true ) ;
44+ } ) ;
45+
46+ it ( "should call to set baseUrl config if env var is defined" , ( ) => {
47+ cypressMock . stubs . env . withArgs ( "MOCKS_SERVER_BASE_URL" ) . returns ( "foo" ) ;
48+ commands ( cypressMock . stubs ) ;
49+ expect (
50+ apiClient . config . calledWith ( {
51+ baseUrl : "foo" ,
52+ } )
53+ ) . toBe ( true ) ;
54+ } ) ;
55+ } ) ;
56+
3557 describe ( "setMock command" , ( ) => {
3658 it ( "should call to update delay" , ( ) => {
3759 setMock ( "foo" ) ;
You can’t perform that action at this time.
0 commit comments