Commit 05d62912d61f5bf5eb09bc037b943a2126cac4ed
1 parent
dc825be3
Exists in
master
and in
30 other branches
fixed environment component and environment service tests
Showing
2 changed files
with
7 additions
and
5 deletions
Show diff stats
src/app/environment/environment.component.spec.ts
| @@ -25,7 +25,7 @@ describe("Components", () => { | @@ -25,7 +25,7 @@ describe("Components", () => { | ||
| 25 | let getBoxesResponse = $q.defer(); | 25 | let getBoxesResponse = $q.defer(); |
| 26 | getBoxesResponse.resolve({ data: { boxes: [{ id: 2 }] } }); | 26 | getBoxesResponse.resolve({ data: { boxes: [{ id: 2 }] } }); |
| 27 | 27 | ||
| 28 | - environmentServiceMock.getByIdentifier('default').and.returnValue(environmentResponse.promise); | 28 | + environmentServiceMock.getByIdentifier = jasmine.createSpy('getByIdentifier').and.returnValue(environmentResponse.promise); |
| 29 | environmentServiceMock.getBoxes = jasmine.createSpy("getBoxes").and.returnValue(getBoxesResponse.promise); | 29 | environmentServiceMock.getBoxes = jasmine.createSpy("getBoxes").and.returnValue(getBoxesResponse.promise); |
| 30 | }); | 30 | }); |
| 31 | 31 | ||
| @@ -40,7 +40,7 @@ describe("Components", () => { | @@ -40,7 +40,7 @@ describe("Components", () => { | ||
| 40 | let component: EnvironmentComponent = new EnvironmentComponent(environmentServiceMock, $state, notificationMock); | 40 | let component: EnvironmentComponent = new EnvironmentComponent(environmentServiceMock, $state, notificationMock); |
| 41 | $rootScope.$apply(); | 41 | $rootScope.$apply(); |
| 42 | expect(environmentServiceMock.getBoxes).toHaveBeenCalled(); | 42 | expect(environmentServiceMock.getBoxes).toHaveBeenCalled(); |
| 43 | - expect(component.boxes).toEqual([{ id: 3 }]); | 43 | + expect(component.boxes).toEqual({ data: { boxes: [{ id: 2 }] } }); |
| 44 | done(); | 44 | done(); |
| 45 | }); | 45 | }); |
| 46 | 46 | ||
| @@ -48,6 +48,8 @@ describe("Components", () => { | @@ -48,6 +48,8 @@ describe("Components", () => { | ||
| 48 | let environmentResponse = $q.defer(); | 48 | let environmentResponse = $q.defer(); |
| 49 | environmentResponse.reject(); | 49 | environmentResponse.reject(); |
| 50 | 50 | ||
| 51 | + environmentServiceMock.getByIdentifier = jasmine.createSpy('getByIdentifier').and.returnValue(environmentResponse.promise); | ||
| 52 | + | ||
| 51 | let component: EnvironmentComponent = new EnvironmentComponent(environmentServiceMock, $state, notificationMock); | 53 | let component: EnvironmentComponent = new EnvironmentComponent(environmentServiceMock, $state, notificationMock); |
| 52 | $rootScope.$apply(); | 54 | $rootScope.$apply(); |
| 53 | 55 |
src/app/layout/blocks/people-block/people-block.component.spec.ts
| @@ -17,10 +17,10 @@ describe("Components", () => { | @@ -17,10 +17,10 @@ describe("Components", () => { | ||
| 17 | new Provider('truncateFilter', { useValue: () => { } }), | 17 | new Provider('truncateFilter', { useValue: () => { } }), |
| 18 | new Provider('stripTagsFilter', { useValue: () => { } }), | 18 | new Provider('stripTagsFilter', { useValue: () => { } }), |
| 19 | new Provider('$state', { useValue: state }), | 19 | new Provider('$state', { useValue: state }), |
| 20 | - new Provider('ProfileService', { | 20 | + new Provider('EnvironmentService', { |
| 21 | useValue: { | 21 | useValue: { |
| 22 | - getProfileMembers: (profileId: number, filters: any): any => { | ||
| 23 | - return Promise.resolve({ data: { people: [{ identifier: "person1" }] } }); | 22 | + getEnvironmentPeople: (filters: any): any => { |
| 23 | + return Promise.resolve([{ identifier: "person1" }]); | ||
| 24 | } | 24 | } |
| 25 | } | 25 | } |
| 26 | }), | 26 | }), |