1 import { HttpClientTestingModule } from '@angular/common/http/testing';
2 import { ComponentFixture, TestBed } from '@angular/core/testing';
3 import { RouterTestingModule } from '@angular/router/testing';
5 import { ToastrModule } from 'ngx-toastr';
7 import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
8 import { ExecutingTask } from '../../../shared/models/executing-task';
9 import { SummaryService } from '../../../shared/services/summary.service';
10 import { SharedModule } from '../../../shared/shared.module';
11 import { NotificationsComponent } from './notifications.component';
13 describe('NotificationsComponent', () => {
14 let component: NotificationsComponent;
15 let fixture: ComponentFixture<NotificationsComponent>;
16 let summaryService: SummaryService;
19 imports: [HttpClientTestingModule, SharedModule, ToastrModule.forRoot(), RouterTestingModule],
20 declarations: [NotificationsComponent],
21 providers: i18nProviders
25 fixture = TestBed.createComponent(NotificationsComponent);
26 component = fixture.componentInstance;
27 summaryService = TestBed.inject(SummaryService);
29 fixture.detectChanges();
32 it('should create', () => {
33 expect(component).toBeTruthy();
36 it('should subscribe and check if there are running tasks', () => {
37 expect(component.hasRunningTasks).toBeFalsy();
39 const task = new ExecutingTask('task', { name: 'name' });
40 summaryService['summaryDataSource'].next({ executing_tasks: [task] });
42 expect(component.hasRunningTasks).toBeTruthy();