diff options
author | Rupinder <rupinsi1@in.ibm.com> | 2020-02-26 15:44:05 +0530 |
---|---|---|
committer | Rupinder <rupinsi1@in.ibm.com> | 2020-02-26 15:44:10 +0530 |
commit | 5c1447aec84394049c8be95cafd59b07d96e51f2 (patch) | |
tree | 3fe817a8c6b336817e749041634800e736b1511f /ecomp-sdk/epsdk-app-os/ngappsrc/src | |
parent | 0ecf3165943135664789f59293145f6847b08c11 (diff) |
wrote test cases for profile.service.spec.ts
written test cases for profile service class
Issue-ID: PORTAL-834
Change-Id: I6920db623e1b967eb9d9d464d671893a7503b4aa
Signed-off-by: Rupinder<rupinsi1@in.ibm.com>
Diffstat (limited to 'ecomp-sdk/epsdk-app-os/ngappsrc/src')
-rw-r--r-- | ecomp-sdk/epsdk-app-os/ngappsrc/src/app/pages/ext/profile/profile.service.spec.ts | 68 |
1 files changed, 67 insertions, 1 deletions
diff --git a/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/pages/ext/profile/profile.service.spec.ts b/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/pages/ext/profile/profile.service.spec.ts index 95b69880..7ac3eb5a 100644 --- a/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/pages/ext/profile/profile.service.spec.ts +++ b/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/pages/ext/profile/profile.service.spec.ts @@ -1,12 +1,78 @@ import { TestBed } from '@angular/core/testing'; import { ProfileService } from './profile.service'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { HttpClient } from '@angular/common/http'; +import { environment } from 'src/environments/environment'; describe('ProfileService', () => { - beforeEach(() => TestBed.configureTestingModule({})); + + let service: ProfileService; + + beforeEach(() => {TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + providers: [ HttpClientTestingModule, HttpClient, ProfileService] + }) + service = TestBed.get(ProfileService); +}); it('should be created', () => { const service: ProfileService = TestBed.get(ProfileService); expect(service).toBeTruthy(); }); + + it('should get getUserPagination', () => { + service.getUserPagination().subscribe((resp) => { + expect(resp).toBe(environment.getUserPagination); + }); + }); + + it('should get getPostSearch', () => { + let test : any; + service.getPostSearch(test).subscribe((resp) => { + expect(resp).toBe(environment.postSearch); + }); + }); + + it('should get importUser', () => { + let test : any; + service.importUser(test).subscribe((resp) => { + expect(resp).toBe(environment.importSearch); + }); }); + +it('should get getPostProfile', () => { + service.getPostProfile().subscribe((resp) => { + expect(resp).toBe(environment.getPostProfile); + }); +}); + +it('should get getSelfProfile', () => { + service.getSelfProfile().subscribe((resp) => { + expect(resp).toBe(environment.getSelfProfile); + }); +}); + +it('should get removeRole', () => { + let data, id; + service.removeRole(data, id).subscribe((resp) => { + expect(resp).toBe(environment.removeUserRole); + }); +}); + +it('should get addUserRole', () => { + let data, id; + service.addUserRole(data, id).subscribe((resp) => { + expect(resp).toBe(environment.addUserRole); + }); +}); + +it('should get toggleProfileActive', () => { + let data, id; + service.toggleProfileActive(id).subscribe((resp) => { + expect(resp).toBe(environment); + }); +}); + +}); + |