Fixed the test cases,added sonar config
[portal.git] / portal-FE-common / src / app / shared / services / admins / admins.service.spec.ts
1 import { TestBed } from '@angular/core/testing';
2
3 import { AdminsService } from './admins.service';
4 import { HttpClientTestingModule } from '@angular/common/http/testing';
5
6 describe('AdminsService', () => {
7   let service: AdminsService;
8   beforeEach(() => TestBed.configureTestingModule({
9     imports:[HttpClientTestingModule]
10   }));
11
12   it('should be created', () => {
13     service = TestBed.get(AdminsService);
14     expect(service).toBeTruthy();
15   });
16   it('getAdminAppsRoles should return stubbed value', () => {
17     spyOn(service, 'getAdminAppsRoles').and.callThrough();
18     service.getAdminAppsRoles("test");
19     expect(service.getAdminAppsRoles).toHaveBeenCalledWith("test");
20   });
21   it('getRolesByApp should return stubbed value', () => {
22     spyOn(service, 'getRolesByApp').and.callThrough();
23     service.getRolesByApp("test");
24     expect(service.getRolesByApp).toHaveBeenCalledWith("test");
25   });
26
27   it('updateAdminAppsRoles should return stubbed value', () => {
28     spyOn(service, 'updateAdminAppsRoles').and.callThrough();
29     service.updateAdminAppsRoles("test");
30     expect(service.updateAdminAppsRoles).toHaveBeenCalledWith("test");
31   });
32
33   it('isComplexPassword should return stubbed value', () => {
34     spyOn(service, 'isComplexPassword').and.callThrough();
35     service.isComplexPassword("testpassword");
36     expect(service.isComplexPassword).toHaveBeenCalledWith("testpassword");
37   });
38
39   it('addNewUser should return stubbed value', () => {
40     spyOn(service, 'addNewUser').and.callThrough();
41     service.addNewUser("testuser","duplicatecheck");
42     expect(service.addNewUser).toHaveBeenCalledWith("testuser","duplicatecheck");
43   });
44 });