summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLorraine Welch <lb2391@att.com>2020-02-24 14:40:55 +0000
committerGerrit Code Review <gerrit@onap.org>2020-02-24 14:40:55 +0000
commitf38b0f61055741546c86c1883c1aca88c5118056 (patch)
tree8e51cc97a42fc53819699e516d60c4560d3daa47
parentdbd30229bd376d31d755b07d7cdca57ec14fd23f (diff)
parent9a5ecbebf8d687c13275d32ad8400ee4b553cc59 (diff)
Merge changes from topic "indriku_PORTAL-813"
* changes: errors resolved in 3 components test case written in header component
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.spec.ts27
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts21
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/column-list/column-list.component.spec.ts23
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/columns-edit-component/edit-drill-down-link/edit-drill-down-link.component.spec.ts15
4 files changed, 65 insertions, 21 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.spec.ts
index 7418893a..4a12cd9f 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.spec.ts
@@ -4,7 +4,9 @@
* ===================================================================
* Copyright © 2019 AT&T Intellectual Property. All rights reserved.
* ===================================================================
- *
+ * Modification Copyright © 2020 IBM.
+ * ===================================================================
+ *
* Unless otherwise specified, all software contained herein is licensed
* under the Apache License, Version 2.0 (the "License");
* you may not use this software except in compliance with the License.
@@ -43,8 +45,11 @@ import { HttpClientModule } from '@angular/common/http';
import { HeaderComponent } from './header.component';
import { LayoutModule } from '../../layout.module';
import { CookieService } from 'ngx-cookie-service';
+import { HeaderService } from 'src/app/shared/services/header/header.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('HeaderComponent', () => {
+ let headerService:HeaderService;
let component: HeaderComponent;
let fixture: ComponentFixture<HeaderComponent>;
@@ -56,6 +61,7 @@ describe('HeaderComponent', () => {
RouterTestingModule,
TranslateModule.forRoot(),
HttpClientModule,
+ HttpClientTestingModule
],
})
.compileComponents();
@@ -65,11 +71,28 @@ describe('HeaderComponent', () => {
fixture = TestBed.createComponent(HeaderComponent);
component = fixture.componentInstance;
fixture.detectChanges();
+ headerService = TestBed.get(HeaderService);
});
it('should create', () => {
expect(component).toBeTruthy();
});
-
+ it('should test ngOnInit method',()=>{
+ fixture.detectChanges();
+ component.ngOnInit();
+ if(component.cookieService.get('show_app_header')=='false')
+ expect(component.showHeader).toBe(false);
+ expect(component.pushRightClass).toEqual('push-right');
+ (done: DoneFn)=> {
+ headerService.getTopMenuItems().subscribe(res=>{
+ expect(component.response).toEqual(res);
+ expect(component.userFirstName).toBe(component.response.firstName);
+ expect(component.userEmail).toBe(component.response.email);
+ expect(component.userId).toBe(component.response.userId);
+ expect(component.userName).toBe(component.response.userName);
+ done();
+ })
+ }
+ });
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts
index 2049b859..b832b6af 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts
@@ -4,7 +4,9 @@
* ===================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ===================================================================
- *
+ * Modification Copyright © 2020 IBM.
+ * ===================================================================
+
* Unless otherwise specified, all software contained herein is licensed
* under the Apache License, Version 2.0 (the "License");
* you may not use this software except in compliance with the License.
@@ -37,8 +39,12 @@
*/
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { NewRoleComponent } from './new-role.component';
+import { FormsModule } from '@angular/forms';
+import { MatTableModule } from '@angular/material';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
describe('NewRoleComponent', () => {
let component: NewRoleComponent;
@@ -46,7 +52,14 @@ describe('NewRoleComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ NewRoleComponent ]
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
+ declarations: [ NewRoleComponent ],
+ imports:[
+ FormsModule,
+ MatTableModule,
+ HttpClientTestingModule
+ ],
+ providers:[NgbActiveModal]
})
.compileComponents();
}));
@@ -60,4 +73,4 @@ describe('NewRoleComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
-});
+}); \ No newline at end of file
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/column-list/column-list.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/column-list/column-list.component.spec.ts
index a4364cc5..6d6e9431 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/column-list/column-list.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/column-list/column-list.component.spec.ts
@@ -1,29 +1,35 @@
+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { MatPaginatorModule } from '@angular/material/paginator';
import { MatSortModule } from '@angular/material/sort';
import { MatTableModule } from '@angular/material/table';
+import { ColumnListComponent } from './column-list.component';
+import { FormsModule } from '@angular/forms';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
-import { DataTableComponent } from './data-table.component';
-
-describe('DataTableComponent', () => {
- let component: DataTableComponent;
- let fixture: ComponentFixture<DataTableComponent>;
+describe('ColumnListComponent', () => {
+ let component: ColumnListComponent;
+ let fixture: ComponentFixture<ColumnListComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ DataTableComponent ],
+ declarations: [ ColumnListComponent ],
imports: [
NoopAnimationsModule,
MatPaginatorModule,
MatSortModule,
MatTableModule,
- ]
+ FormsModule,
+ HttpClientTestingModule
+ ],
+ schemas: [CUSTOM_ELEMENTS_SCHEMA]
}).compileComponents();
}));
beforeEach(() => {
- fixture = TestBed.createComponent(DataTableComponent);
+ fixture = TestBed.createComponent(ColumnListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
@@ -31,4 +37,5 @@ describe('DataTableComponent', () => {
it('should compile', () => {
expect(component).toBeTruthy();
});
+
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/columns-edit-component/edit-drill-down-link/edit-drill-down-link.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/columns-edit-component/edit-drill-down-link/edit-drill-down-link.component.spec.ts
index ad5f13fe..957be88b 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/columns-edit-component/edit-drill-down-link/edit-drill-down-link.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/columns-edit-component/edit-drill-down-link/edit-drill-down-link.component.spec.ts
@@ -1,6 +1,8 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { EditDrillDownLinkComponent } from './edit-drill-down-link.component';
+import { FormsModule } from '@angular/forms';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('EditDrillDownLinkComponent', () => {
let component: EditDrillDownLinkComponent;
@@ -8,7 +10,11 @@ describe('EditDrillDownLinkComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ EditDrillDownLinkComponent ]
+ declarations: [ EditDrillDownLinkComponent ],
+ imports:[
+ FormsModule,
+ HttpClientTestingModule
+ ]
})
.compileComponents();
}));
@@ -17,9 +23,4 @@ describe('EditDrillDownLinkComponent', () => {
fixture = TestBed.createComponent(EditDrillDownLinkComponent);
component = fixture.componentInstance;
fixture.detectChanges();
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
-});
+ }); \ No newline at end of file