diff --git a/modules/ui/src/app/store/effects.spec.ts b/modules/ui/src/app/store/effects.spec.ts index 92cddf9fb..36022a905 100644 --- a/modules/ui/src/app/store/effects.spec.ts +++ b/modules/ui/src/app/store/effects.spec.ts @@ -35,6 +35,7 @@ import { } from './selectors'; import { device } from '../mocks/device.mock'; import { + MOCK_PROGRESS_DATA_CANCELLING, MOCK_PROGRESS_DATA_IN_PROGRESS, MOCK_PROGRESS_DATA_WAITING_FOR_DEVICE, } from '../mocks/testrun.mock'; @@ -103,6 +104,19 @@ describe('Effects', () => { }); }); + it('onSetTestrunStatus$ should setDeviceInProgress when testrun cancelling', done => { + testRunServiceMock.testrunInProgress.and.returnValue(false); + const status = MOCK_PROGRESS_DATA_CANCELLING; + actions$ = of(actions.setTestrunStatus({ systemStatus: status })); + + effects.onSetTestrunStatus$.subscribe(action => { + expect(action).toEqual( + actions.setDeviceInProgress({ device: status.device }) + ); + done(); + }); + }); + it('onSetDevices$ should call setHasDevices', done => { actions$ = of(actions.setDevices({ devices: [device] })); diff --git a/modules/ui/src/app/store/effects.ts b/modules/ui/src/app/store/effects.ts index ee082a178..9b8a95533 100644 --- a/modules/ui/src/app/store/effects.ts +++ b/modules/ui/src/app/store/effects.ts @@ -129,10 +129,11 @@ export class AppEffects { return this.actions$.pipe( ofType(AppActions.setTestrunStatus), map(({ systemStatus }) => { + const isInProgressDevice = + this.testrunService.testrunInProgress(systemStatus?.status) || + systemStatus.status === StatusOfTestrun.Cancelling; return AppActions.setDeviceInProgress({ - device: this.testrunService.testrunInProgress(systemStatus?.status) - ? systemStatus.device - : null, + device: isInProgressDevice ? systemStatus.device : null, }); }) );