Fixed the test cases,added sonar config
[portal.git] / portal-FE-common / src / app / shared / services / user-profile / user-profile.service.spec.ts
index b1d5e6b..265ae40 100644 (file)
 import { TestBed } from '@angular/core/testing';
 
 import { UserProfileService } from './user-profile.service';
-
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { Observable } from 'rxjs';
+import 'rxjs/add/observable/of';
 describe('UserProfileService', () => {
-  beforeEach(() => TestBed.configureTestingModule({}));
+  // set the value to return when the `getValue` spy is called.
+  const stubValue = 'stub value';
+  const NODE_CONFIG: Array<any> = [];
+  beforeEach(() => 
+  {
+  TestBed.configureTestingModule({imports:[HttpClientTestingModule]})
+  
+  }
+
+    );
 
   it('should be created', () => {
     const service: UserProfileService = TestBed.get(UserProfileService);
     expect(service).toBeTruthy();
   });
+
+  it('getUserAppRoles should return stubbed value', () => {
+    const service: UserProfileService = TestBed.get(UserProfileService);
+    spyOn(service, 'getUserAppRoles').and.callThrough();
+    service.getUserAppRoles("TEST");
+    expect(service.getUserAppRoles).toHaveBeenCalledWith("TEST")  
+  });
 });