summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonan Kenny <ronan.kenny@ericsson.com>2018-10-11 15:48:26 +0100
committerRonan Kenny <ronan.kenny@ericsson.com>2018-10-12 08:36:59 +0000
commit88093c9aec11f72e0bac9dffa254b7c5e307bc6d (patch)
tree76c741f76e8dd6f4bdf51b1c2f4b44b05b2aba8d
parentea7f1ce7584deb1e4896ffcddb8c45e64422a9d0 (diff)
Fixing SO-Monitoring UI tests
Change-Id: I0601c024474196dc965ec7a7f16c4bca11af80f9 Issue-ID: SO-1125 Signed-off-by: Ronan Kenny <ronan.kenny@ericsson.com>
-rw-r--r--.gitignore1
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.component.spec.ts22
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.component.ts2
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts11
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.spec.ts81
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.ts2
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.spec.ts115
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.spec.ts49
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/http-error-handler.service.spec.ts11
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/sidebar/sidebar.component.spec.ts22
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/toastr-notification-service.service.spec.ts10
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/topbar/topbar.component.spec.ts8
12 files changed, 285 insertions, 49 deletions
diff --git a/.gitignore b/.gitignore
index 51723ae248..8eeea7a8cc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,3 +20,4 @@ packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/main-schemas/M
packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/main-schemas/MySQL-Requests-schema.sql
**/bin/
/tattletale/
+/.metadata/
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.component.spec.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.component.spec.ts
index 076be174fb..cb5f53b7d4 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.component.spec.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.component.spec.ts
@@ -23,6 +23,8 @@ SPDX-License-Identifier: Apache-2.0
import { TestBed, async } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
@@ -32,22 +34,24 @@ describe('AppComponent', () => {
declarations: [
AppComponent
],
+ schemas: [
+ CUSTOM_ELEMENTS_SCHEMA
+ ],
}).compileComponents();
}));
- it('should create the app', async(() => {
+
+ // Ensure creation of SO Monitoring application
+ it('application should be created', async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
- it(`should have as title 'app'`, async(() => {
+
+
+ // Ensure application title is "SO Monitor"
+ it(`should have title 'SO Monitor'`, async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
- expect(app.title).toEqual('app');
- }));
- it('should render title in a h1 tag', async(() => {
- const fixture = TestBed.createComponent(AppComponent);
- fixture.detectChanges();
- const compiled = fixture.debugElement.nativeElement;
- expect(compiled.querySelector('h1').textContent).toContain('Welcome to ONAP-SO-Monitor!');
+ expect(app.title).toEqual('SO Monitor');
}));
});
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.component.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.component.ts
index 2750e4780f..bac6643783 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.component.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.component.ts
@@ -29,5 +29,5 @@ import { Component } from '@angular/core';
})
export class AppComponent {
- title = 'app';
+ title = 'SO Monitor';
}
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts
index b9437ccb75..3d736edb95 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts
@@ -21,7 +21,7 @@ SPDX-License-Identifier: Apache-2.0
*/
import { BrowserModule } from '@angular/platform-browser';
-import { NgModule } from '@angular/core';
+import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
@@ -41,6 +41,8 @@ import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatNativeDateModule } from '@angular/material';
import { MatCardModule } from '@angular/material/card';
import { NgxSpinnerModule } from 'ngx-spinner';
+import { RouterModule, Routes } from '@angular/router';
+import { APP_BASE_HREF } from '@angular/common';
@NgModule({
declarations: [
@@ -64,7 +66,12 @@ import { NgxSpinnerModule } from 'ngx-spinner';
MatDatepickerModule,
MatNativeDateModule,
MatCardModule,
- NgxSpinnerModule
+ NgxSpinnerModule,
+ RouterModule,
+ RouterModule.forRoot([])
+ ],
+ schemas: [
+ CUSTOM_ELEMENTS_SCHEMA
],
providers: [ToastrNotificationService],
bootstrap: [AppComponent]
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.spec.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.spec.ts
index 987d29d548..834b8c34ea 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.spec.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.spec.ts
@@ -23,15 +23,88 @@ SPDX-License-Identifier: Apache-2.0
import { TestBed, inject } from '@angular/core/testing';
import { DataService } from './data.service';
+import { HttpClient } from '@angular/common/http';
+import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
+import { async } from '@angular/core/testing';
+import { HttpClientModule } from '@angular/common/http';
+import { ToastrNotificationService } from './toastr-notification-service.service';
+import { environment } from '../environments/environment';
+
+class StubbedToastrNotificationService extends ToastrNotificationService {
+ toastrSettings() {
+ }
+}
describe('DataService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
- providers: [DataService]
+ providers: [DataService, { provide: ToastrNotificationService, useClass: StubbedToastrNotificationService }],
+ imports: [HttpClientTestingModule]
});
});
- it('should be created', inject([DataService], (service: DataService) => {
- expect(service).toBeTruthy();
- }));
+ // Ensure creation of DataService component
+ it('component should be created', async(inject([HttpTestingController, DataService, ToastrNotificationService],
+ (httpClient: HttpTestingController, service: DataService, toastr: ToastrNotificationService) => {
+ expect(service).toBeTruthy();
+ })));
+
+ // Test retrieveInstance function making POST call
+ it('test retrieveInstance POST request', async(inject([HttpTestingController, DataService, ToastrNotificationService],
+ (httpClient: HttpTestingController, service: DataService, toastr: ToastrNotificationService) => {
+ service.retrieveInstance({}, 1, 2).subscribe(data => { });
+ var url = environment.soMonitoringBackendURL + 'v1/search?from=1&to=2';
+ const mockReq = httpClient.expectOne(url);
+ expect(mockReq.request.method).toEqual('POST');
+ mockReq.flush({});
+ })));
+
+ // Test getProcessInstanceId function making GET request to retrieve processInstanceID
+ it('test getProcessInstanceId GET request', async(inject([HttpTestingController, DataService, ToastrNotificationService],
+ (httpClient: HttpTestingController, service: DataService, toastr: ToastrNotificationService) => {
+ service.getProcessInstanceId("").subscribe(data => { });
+ var url = environment.soMonitoringBackendURL + 'process-instance-id/' + "";
+ const mockReq = httpClient.expectOne(url);
+ expect(mockReq.request.method).toEqual('GET');
+ mockReq.flush({});
+ })));
+
+ // Test getActivityInstance function making GET request to retrieve activityInstance
+ it('test getActivityInstance GET request', async(inject([HttpTestingController, DataService, ToastrNotificationService],
+ (httpClient: HttpTestingController, service: DataService, toastr: ToastrNotificationService) => {
+ service.getActivityInstance("").subscribe(data => { });
+ var url = environment.soMonitoringBackendURL + 'activity-instance/' + "";
+ const mockReq = httpClient.expectOne(url);
+ expect(mockReq.request.method).toEqual('GET');
+ mockReq.flush({});
+ })));
+
+ // Test getProcessInstance function making GET request to retrieve processInstance
+ it('test getProcessInstance GET request', async(inject([HttpTestingController, DataService, ToastrNotificationService],
+ (httpClient: HttpTestingController, service: DataService, toastr: ToastrNotificationService) => {
+ service.getProcessInstance("");
+ var url = environment.soMonitoringBackendURL + 'process-instance/' + "";
+ const mockReq = httpClient.expectOne(url);
+ expect(mockReq.request.method).toEqual('GET');
+ })));
+
+ // Test getProcessDefinition function making GET request to retrieve processDefinition
+ it('test getProcessDefinition GET request', async(inject([HttpTestingController, DataService, ToastrNotificationService],
+ (httpClient: HttpTestingController, service: DataService, toastr: ToastrNotificationService) => {
+ service.getProcessDefinition("").subscribe(data => { });
+ var url = environment.soMonitoringBackendURL + 'process-definition/' + "";
+ const mockReq = httpClient.expectOne(url);
+ expect(mockReq.request.method).toEqual('GET');
+ mockReq.flush({});
+ })));
+
+ // Test getVariableInstance function making GET request to retrieve variableInstance
+ it('test getVariableInstance GET request', async(inject([HttpTestingController, DataService, ToastrNotificationService],
+ (httpClient: HttpTestingController, service: DataService, toastr: ToastrNotificationService) => {
+ service.getVariableInstance("").subscribe(data => { });
+ var url = environment.soMonitoringBackendURL + 'variable-instance/' + "";
+ const mockReq = httpClient.expectOne(url);
+ expect(mockReq.request.method).toEqual('GET');
+ mockReq.flush({});
+ })));
});
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.ts
index 8913eaa86f..796739077c 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.ts
@@ -52,7 +52,6 @@ export class DataService {
getProcessInstanceId(requestId): Observable<HttpResponse<ProcessInstanceId>> {
var url = environment.soMonitoringBackendURL + 'process-instance-id/' + requestId;
console.log(requestId);
- console.log(url);
return this.http.get<ProcessInstanceId>(url, { observe: 'response' })
.pipe(
catchError(this.httpErrorHandlerService.handleError("GET", url))
@@ -92,5 +91,4 @@ export class DataService {
catchError(this.httpErrorHandlerService.handleError("GET", url))
);
}
-
}
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.spec.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.spec.ts
index 690c143b5f..8205226f9e 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.spec.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.spec.ts
@@ -23,25 +23,116 @@ SPDX-License-Identifier: Apache-2.0
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { DetailsComponent } from './details.component';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { RouterTestingModule } from '@angular/router/testing';
+import { MatTableModule } from '@angular/material';
+import { inject } from '@angular/core/testing';
+import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
+import { HttpClientModule } from '@angular/common/http';
+import { HttpClient } from '@angular/common/http';
+import { RouterModule } from '@angular/router';
+import { APP_BASE_HREF } from '@angular/common';
+import { ToastrNotificationService } from '../toastr-notification-service.service';
+import { DataService } from '../data.service';
+import { Observable, of } from 'rxjs';
+import { ACTINST } from '../model/activityInstance.model';
+import { PDI } from '../model/processDefinition.model';
+import { PII } from '../model/processInstance.model';
+import { VarInstance } from '../model/variableInstance.model';
-describe('DetailsComponent', () => {
- let component: DetailsComponent;
- let fixture: ComponentFixture<DetailsComponent>;
+// Generate stub for toastr popup notifications
+class StubbedToastrNotificationService extends ToastrNotificationService {
+ toastrSettings() {
+ }
+}
+
+// Create SPY Object for Jasmine tests to mock DataService
+let spyDataService: jasmine.SpyObj<DataService>;
+describe('DetailsComponent', () => {
beforeEach(async(() => {
+ spyDataService = jasmine.createSpyObj('DataService', ['getActivityInstance', 'getVariableInstance']);
+
TestBed.configureTestingModule({
- declarations: [DetailsComponent]
+ providers: [DetailsComponent, HttpClient, HttpTestingController,
+ { provide: APP_BASE_HREF, useValue: '/' },
+ { provide: ToastrNotificationService, useClass: StubbedToastrNotificationService },
+ { provide: DataService, useValue: spyDataService }],
+ imports: [RouterTestingModule, MatTableModule, HttpClientModule, RouterModule.forRoot([])],
+ schemas: [
+ CUSTOM_ELEMENTS_SCHEMA
+ ]
})
.compileComponents();
}));
- beforeEach(() => {
- fixture = TestBed.createComponent(DetailsComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- });
+ // Ensure creation of DetailsComponent component
+ it('component should be created', inject([DetailsComponent],
+ (detailsComponent: DetailsComponent) => {
+ expect(detailsComponent).toBeTruthy();
+ }));
+
+
+ // Mock an activityInstance and ensure array is populated
+ it('activityInstance should be defined if data service returns activities', inject([DetailsComponent],
+ (detailsComponent: DetailsComponent) => {
+ const activity: ACTINST = {
+ activityId: "",
+ processInstanceId: "",
+ calledProcessInstanceId: "",
+ activityName: "",
+ activityType: "",
+ durationInMillis: "1",
+ endTime: "",
+ startTime: ""
+ };
+ spyDataService.getActivityInstance.and.returnValue(of([activity]));
+ detailsComponent.getActInst("");
+ expect(detailsComponent.activityInstance.length).toEqual(1);
+ }));
+
+
+ // Create a processDefinition and ensure it is defined
+ it('processDefinition should be defined if PDI populated', inject([DetailsComponent],
+ (detailsComponent: DetailsComponent) => {
+ const activity: PDI = {
+ processDefinitionId: "1",
+ processDefinitionXml: ""
+ };
+ detailsComponent.getProcessDefinition("");
+ detailsComponent.processDefinition = activity;
+ expect(detailsComponent.processDefinition).toBeDefined();
+ }));
+
+
+ // Create a processInstance and ensure it is defined
+ it('processInstance should be defined if PII populated', inject([DetailsComponent],
+ (detailsComponent: DetailsComponent) => {
+ const testVals: PII = {
+ processInstancId: "1",
+ processDefinitionId: "1",
+ processDefinitionName: "test",
+ superProcessInstanceId: "1"
+ };
+ detailsComponent.getProcInstance("");
+ detailsComponent.processInstance = testVals;
+ expect(detailsComponent.processInstance).toBeDefined();
+ }));
+
+
+ // displayCamundaflow test
+ // TODO
- it('should create', () => {
- expect(component).toBeTruthy();
- });
+ // Mock an variableInstance and ensure array is populated
+ it('variableInstance should be defined if data service returns activities', inject([DetailsComponent],
+ (detailsComponent: DetailsComponent) => {
+ const activity2: VarInstance = {
+ name: "a",
+ type: "a",
+ value: "1"
+ };
+ spyDataService.getVariableInstance.and.returnValue(of([activity2]));
+ detailsComponent.getVarInst("");
+ expect(detailsComponent.variableInstance.length).toEqual(1);
+ }));
});
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.spec.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.spec.ts
index 9da8ba93f1..1e1485eaca 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.spec.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.spec.ts
@@ -23,6 +23,23 @@ SPDX-License-Identifier: Apache-2.0
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { HomeComponent } from './home.component';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { MatTableModule } from '@angular/material';
+import { FormsModule } from '@angular/forms';
+import { MatDatepickerModule } from '@angular/material/datepicker';
+import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
+import { HttpClientModule } from '@angular/common/http';
+import { HttpClient } from '@angular/common/http';
+import { inject } from '@angular/core/testing';
+import { RouterModule } from '@angular/router';
+import { APP_BASE_HREF } from '@angular/common';
+import { ToastrNotificationService } from '../toastr-notification-service.service';
+import { environment } from '../../environments/environment.prod';
+
+class StubbedToastrNotificationService extends ToastrNotificationService {
+ toastrSettings() {
+ }
+}
describe('HomeComponent', () => {
let component: HomeComponent;
@@ -30,18 +47,32 @@ describe('HomeComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [HomeComponent]
+ providers: [HomeComponent, HttpClient, HttpTestingController,
+ { provide: APP_BASE_HREF, useValue: '/' },
+ { provide: ToastrNotificationService, useClass: StubbedToastrNotificationService }],
+ imports: [MatTableModule, FormsModule, MatDatepickerModule, HttpClientModule, RouterModule.forRoot([])],
+ declarations: [HomeComponent],
+ schemas: [
+ CUSTOM_ELEMENTS_SCHEMA
+ ]
})
.compileComponents();
}));
- beforeEach(() => {
- fixture = TestBed.createComponent(HomeComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- });
+ // Ensure creation of HomeComponent component
+ it('component should be created', inject([HttpTestingController, HomeComponent],
+ (httpClient: HttpTestingController, service: HomeComponent) => {
+ expect(service).toBeTruthy();
+ }));
- it('should create', () => {
- expect(component).toBeTruthy();
- });
+ // Ensure all statistic variables are initialised to zero
+ it('ensure statistic variables are defaulted at zero', async(inject([HttpTestingController, HomeComponent],
+ (httpClient: HttpTestingController, service: HomeComponent) => {
+ expect(service.totalVal === 0 && service.completeVal === 0 &&
+ service.inProgressVal === 0 && service.failedVal === 0 &&
+ service.pendingVal === 0 && service.unlockedVal === 0 &&
+ service.percentageComplete === 0 && service.percentageFailed === 0 &&
+ service.percentageInProg === 0 && service.percentagePending === 0 &&
+ service.percentageUnlocked === 0).toBeTruthy();
+ })));
});
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/http-error-handler.service.spec.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/http-error-handler.service.spec.ts
index 0ecdf15d9e..9be827a69d 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/http-error-handler.service.spec.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/http-error-handler.service.spec.ts
@@ -23,15 +23,22 @@ SPDX-License-Identifier: Apache-2.0
import { TestBed, inject } from '@angular/core/testing';
import { HttpErrorHandlerService } from './http-error-handler.service';
+import { ToastrNotificationService } from './toastr-notification-service.service';
+
+class StubbedToastrNotificationService extends ToastrNotificationService {
+ toastrSettings() {
+ }
+}
describe('HttpErrorHandlerService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
- providers: [HttpErrorHandlerService]
+ providers: [HttpErrorHandlerService,
+ { provide: ToastrNotificationService, useClass: StubbedToastrNotificationService }],
});
});
- it('should be created', inject([HttpErrorHandlerService], (service: HttpErrorHandlerService) => {
+ it('ErrorHandler should be created', inject([HttpErrorHandlerService], (service: HttpErrorHandlerService) => {
expect(service).toBeTruthy();
}));
});
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/sidebar/sidebar.component.spec.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/sidebar/sidebar.component.spec.ts
index df51723f98..5068c2593e 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/sidebar/sidebar.component.spec.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/sidebar/sidebar.component.spec.ts
@@ -23,6 +23,13 @@ SPDX-License-Identifier: Apache-2.0
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SidebarComponent } from './sidebar.component';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { HttpClientModule } from '@angular/common/http';
+import { HttpTestingController } from '@angular/common/http/testing';
+import { HttpClient } from '@angular/common/http';
+import { inject } from '@angular/core/testing';
+import { RouterModule } from '@angular/router';
+import { APP_BASE_HREF } from '@angular/common';
describe('SidebarComponent', () => {
let component: SidebarComponent;
@@ -30,7 +37,12 @@ describe('SidebarComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [SidebarComponent]
+ providers: [SidebarComponent, HttpClient, HttpTestingController, { provide: APP_BASE_HREF, useValue: '/' }],
+ imports: [HttpClientModule, RouterModule.forRoot([])],
+ declarations: [SidebarComponent],
+ schemas: [
+ CUSTOM_ELEMENTS_SCHEMA
+ ]
})
.compileComponents();
}));
@@ -41,7 +53,9 @@ describe('SidebarComponent', () => {
fixture.detectChanges();
});
- it('should create', () => {
- expect(component).toBeTruthy();
- });
+ it('component should be created', async(inject([HttpTestingController, SidebarComponent],
+ (httpClient: HttpTestingController, sideComponent: SidebarComponent) => {
+ expect(sideComponent).toBeTruthy();
+ })));
+
});
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/toastr-notification-service.service.spec.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/toastr-notification-service.service.spec.ts
index 062cc905a4..cb685c9e98 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/toastr-notification-service.service.spec.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/toastr-notification-service.service.spec.ts
@@ -24,14 +24,20 @@ import { TestBed, inject } from '@angular/core/testing';
import { ToastrNotificationService } from './toastr-notification-service.service';
+class StubbedToastrNotificationService extends ToastrNotificationService {
+ toastrSettings() {
+ }
+}
+
describe('ToasterNotificationService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
- providers: [ToastrNotificationService]
+ providers: [ToastrNotificationService,
+ { provide: ToastrNotificationService, useClass: StubbedToastrNotificationService }]
});
});
- it('should be created', inject([ToastrNotificationService], (service: ToastrNotificationService) => {
+ it('component should be created', inject([ToastrNotificationService], (service: ToastrNotificationService) => {
expect(service).toBeTruthy();
}));
});
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/topbar/topbar.component.spec.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/topbar/topbar.component.spec.ts
index 0bc691ca7e..3d402bf1e9 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/topbar/topbar.component.spec.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/topbar/topbar.component.spec.ts
@@ -23,6 +23,7 @@ SPDX-License-Identifier: Apache-2.0
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { TopbarComponent } from './topbar.component';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
describe('TopbarComponent', () => {
let component: TopbarComponent;
@@ -30,7 +31,10 @@ describe('TopbarComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [TopbarComponent]
+ declarations: [TopbarComponent],
+ schemas: [
+ CUSTOM_ELEMENTS_SCHEMA
+ ]
})
.compileComponents();
}));
@@ -41,7 +45,7 @@ describe('TopbarComponent', () => {
fixture.detectChanges();
});
- it('should create', () => {
+ it('component should be created', () => {
expect(component).toBeTruthy();
});
});