summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay
diff options
context:
space:
mode:
authorLorraine Welch <lb2391@att.com>2020-03-04 14:56:38 +0000
committerGerrit Code Review <gerrit@onap.org>2020-03-04 14:56:38 +0000
commit46607ab706824f57828c3fc21b9ec094fa66ddf4 (patch)
tree1367568f88f23dfe13ec821eae72b5c3229f2be6 /ecomp-sdk/epsdk-app-overlay
parentbf80005a521b13708b88c6c4e69041e4365956a2 (diff)
parent4d6d26f15e748f5b1127c50b484f8cf7eab2dc14 (diff)
Merge "test cases written in role-functions component"
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay')
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.component.spec.ts52
1 files changed, 48 insertions, 4 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.component.spec.ts
index b0dc3442..8c958531 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.component.spec.ts
@@ -4,6 +4,8 @@
* ===================================================================
* 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");
@@ -35,28 +37,70 @@
*
*
*/
-import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { async, ComponentFixture, TestBed, inject } from '@angular/core/testing';
import { RoleFunctionsComponent } from './role-functions.component';
+import { CUSTOM_ELEMENTS_SCHEMA} from '@angular/core';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { RdpModule } from 'portalsdk-tag-lib';
+import { FormsModule, ReactiveFormsModule } from '@angular/forms';
+import { UserService } from 'src/app/shared/services/user/user.service';
+import { AdminService } from '../admin.service';
+import { MatSelectModule, MatAutocompleteModule } from '@angular/material';
+import { Observable } from 'rxjs';
describe('RoleFunctionsComponent', () => {
let component: RoleFunctionsComponent;
let fixture: ComponentFixture<RoleFunctionsComponent>;
+ let userService:UserService;
+ let adminService:AdminService;
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ RoleFunctionsComponent ]
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
+ declarations: [ RoleFunctionsComponent ],
+ imports: [HttpClientTestingModule,
+ RdpModule,
+ FormsModule,
+ // MatSelectModule,
+ ],
+ providers:[MatSelectModule]
})
.compileComponents();
- }));
+ }));
beforeEach(() => {
+ TestBed.configureTestingModule({
+ providers:[AdminService]
+ })
fixture = TestBed.createComponent(RoleFunctionsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
+ userService=TestBed.get(UserService);
+ adminService=TestBed.get(AdminService);
});
- it('should create', () => {
+ it('should create', () => {
expect(component).toBeTruthy();
});
+
+ describe('test for subscribe in ngOnInit',()=>{
+ it('should test ngOnInit method',()=>{
+ let spy=spyOn(userService,'getFunctionalMenuStaticDetailSession').and.returnValue(Observable.of('you object'));
+ component.ngOnInit();
+ expect(spy).toHaveBeenCalled();
+ })
+ })
+ it('Admin service injection check', inject([AdminService],(injectService:AdminService) =>{
+ expect(injectService).toBe(adminService);
+ }));
+
+ // describe('test subscribe in getRoleFunctions',()=>{
+ // it('should test getRoleFunctions method',()=>{
+ // let spy=spyOn(adminService,'getRoleFunctionList').and.returnValue(Observable.of('you object'));
+ // component.getRoleFunctions();
+ // expect(spy).toHaveBeenCalled();
+ // })
+ // })
+
});