@@ -57,8 +57,8 @@ function mockActiveExecutions(executions) {
5757 }
5858}
5959
60- function mockStartResponse ( id ) {
61- axiosMock . onPost ( 'executions/start' ) . reply ( 200 , id ) ;
60+ function mockStartResponse ( id , status = 200 ) {
61+ axiosMock . onPost ( 'executions/start' ) . reply ( status , id ) ;
6262}
6363
6464describe ( 'Test scriptExecutionManager' , function ( ) {
@@ -148,6 +148,27 @@ describe('Test scriptExecutionManager', function () {
148148
149149 assertSelectedExecutor ( 12 ) ;
150150 } ) ;
151+
152+ it ( 'Test startExecution twice, when first is error' , async function ( ) {
153+ store . state . scripts . selectedScript = 'abc' ;
154+
155+ mockStartResponse ( null , 500 ) ;
156+
157+ await store . dispatch ( 'executions/startExecution' ) ;
158+ await flushPromises ( ) ;
159+
160+ const currentExecutor = store . state . executions . currentExecutor ;
161+ expect ( currentExecutor ) . not . toBeNil ( ) ;
162+ expect ( currentExecutor . state . id ) . toBeNil ( ) ;
163+ expect ( currentExecutor . state . scriptName ) . toEqual ( 'abc' ) ;
164+
165+ mockStartResponse ( 123 ) ;
166+
167+ await store . dispatch ( 'executions/startExecution' ) ;
168+ await flushPromises ( ) ;
169+
170+ assertSelectedExecutor ( 123 ) ;
171+ } ) ;
151172 } ) ;
152173
153174 describe ( 'Test selectExecutor' , function ( ) {
0 commit comments