Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions modules/ui/src/app/app.store.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,6 @@ import { fetchSystemStatus, setDevices } from './store/actions';
import { MOCK_PROGRESS_DATA_IN_PROGRESS } from './mocks/testrun.mock';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NotificationService } from './services/notification.service';
import { WINDOW } from './providers/window.provider';
import { Routes } from './model/routes';

const windowMock = {
location: {
href: '',
},
};

const mock = (() => {
let store: { [key: string]: string } = {};
Expand Down Expand Up @@ -84,7 +76,6 @@ describe('AppStore', () => {
}),
{ provide: TestRunService, useValue: mockService },
{ provide: NotificationService, useValue: mockNotificationService },
{ provide: WINDOW, useValue: windowMock },
],
imports: [BrowserAnimationsModule],
});
Expand Down Expand Up @@ -201,28 +192,6 @@ describe('AppStore', () => {
);
store.refreshState();
});

it('should notify when url is not "/testing"', () => {
windowMock.location.href = 'localhost:8080';
store.overrideSelector(
selectStatus,
MOCK_PROGRESS_DATA_IN_PROGRESS.status
);
store.refreshState();

expect(mockNotificationService.notify).toHaveBeenCalled();
});

it('should not notify when url is "/testing"', () => {
windowMock.location.href = 'localhost:8080/' + Routes.Testing;
store.overrideSelector(
selectStatus,
MOCK_PROGRESS_DATA_IN_PROGRESS.status
);
store.refreshState();

expect(mockNotificationService.notify).toHaveBeenCalledTimes(0);
});
});
});
});
14 changes: 3 additions & 11 deletions modules/ui/src/app/app.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { Inject, Injectable } from '@angular/core';
import { Injectable } from '@angular/core';
import { ComponentStore } from '@ngrx/component-store';
import { tap } from 'rxjs/operators';
import {
Expand All @@ -37,9 +37,6 @@ import {
} from './store/actions';
import { TestrunStatus } from './model/testrun-status';
import { SettingMissedError, SystemInterfaces } from './model/setting';
import { NotificationService } from './services/notification.service';
import { Routes } from './model/routes';
import { WINDOW } from './providers/window.provider';

export const CONSENT_SHOWN_KEY = 'CONSENT_SHOWN';
export interface AppComponentState {
Expand Down Expand Up @@ -107,11 +104,8 @@ export class AppStore extends ComponentStore<AppComponentState> {
statusLoaded = this.effect(() => {
return this.systemStatus$.pipe(
skip(1),
tap(status => {
tap(() => {
this.updateIsStatusLoaded(true);
if (!this.window.location.href.includes(Routes.Testing)) {
this.notification.notify(`Test run is ${status}`);
}
})
);
});
Expand All @@ -136,9 +130,7 @@ export class AppStore extends ComponentStore<AppComponentState> {

constructor(
private store: Store<AppState>,
private testRunService: TestRunService,
private notification: NotificationService,
@Inject(WINDOW) private window: Window
private testRunService: TestRunService
) {
super({
consentShown: sessionStorage.getItem(CONSENT_SHOWN_KEY) !== null,
Expand Down