@@ -69,31 +69,46 @@ describe('Action Input operations for fetching all inputs, triggering validation
6969 } ) ;
7070
7171 context ( 'Set Environment Variables' , ( ) => {
72+ let actionInput ;
73+
7274 beforeEach ( ( ) => {
7375 sinon . stub ( core , 'exportVariable' ) ;
7476 sinon . stub ( core , 'info' ) ;
7577 sinon . stub ( core , 'startGroup' ) ;
7678 sinon . stub ( core , 'endGroup' ) ;
7779 sinon . stub ( ActionInput . prototype , '_fetchAllInput' ) ;
7880 sinon . stub ( ActionInput . prototype , '_validateInput' ) ;
81+
82+ // Mock required properties
83+ actionInput = new ActionInput ( ) ;
84+ actionInput . username = 'someUsername' ;
85+ actionInput . accessKey = 'someAccessKey' ;
86+ actionInput . buildName = 'someBuildName' ;
87+ actionInput . projectName = 'someProjectName' ;
88+
89+ // Stub checkIfBStackReRun to return true
90+ sinon . stub ( actionInput , 'checkIfBStackReRun' ) . returns ( Promise . resolve ( true ) ) ;
7991 } ) ;
8092
8193 afterEach ( ( ) => {
8294 sinon . restore ( ) ;
8395 } ) ;
8496
8597 it ( 'Sets the environment variables required in test scripts for BrowserStack' , ( ) => {
86- const actionInput = new ActionInput ( ) ;
87- actionInput . username = 'someUsername' ;
88- actionInput . accessKey = 'someAccessKey' ;
89- actionInput . buildName = 'someBuildName' ;
90- actionInput . projectName = 'someProjectName' ;
9198 actionInput . setEnvVariables ( ) ;
9299 sinon . assert . calledWith ( core . exportVariable , ENV_VARS . BROWSERSTACK_USERNAME , 'someUsername' ) ;
93100 sinon . assert . calledWith ( core . exportVariable , ENV_VARS . BROWSERSTACK_ACCESS_KEY , 'someAccessKey' ) ;
94101 sinon . assert . calledWith ( core . exportVariable , ENV_VARS . BROWSERSTACK_PROJECT_NAME , 'someProjectName' ) ;
95102 sinon . assert . calledWith ( core . exportVariable , ENV_VARS . BROWSERSTACK_BUILD_NAME , 'someBuildName' ) ;
96103 } ) ;
104+
105+ it ( 'Calls setBStackRerunEnvVars when checkIfBStackReRun returns true' , async ( ) => {
106+ const setBStackRerunEnvVarsStub = sinon . stub ( actionInput , 'setBStackRerunEnvVars' ) . resolves ( ) ;
107+
108+ await actionInput . setEnvVariables ( ) ;
109+
110+ sinon . assert . calledOnce ( setBStackRerunEnvVarsStub ) ;
111+ } ) ;
97112 } ) ;
98113
99114 context ( 'Check if BrowserStack Rerun' , ( ) => {
0 commit comments