Commits
Alexandre Vryghem authored dce84dbe70d
1 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; |
2 + | import { Location } from '@angular/common'; |
2 3 | import { AdvancedWorkflowActionComponent } from './advanced-workflow-action.component'; |
3 4 | import { Component } from '@angular/core'; |
4 5 | import { MockComponent } from 'ng-mocks'; |
5 6 | import { DSOSelectorComponent } from '../../../shared/dso-selector/dso-selector/dso-selector.component'; |
6 7 | import { ClaimedTaskDataService } from '../../../core/tasks/claimed-task-data.service'; |
7 8 | import { ClaimedTaskDataServiceStub } from '../../../shared/testing/claimed-task-data-service.stub'; |
8 9 | import { ActivatedRoute } from '@angular/router'; |
9 10 | import { of as observableOf } from 'rxjs'; |
10 11 | import { WorkflowItemDataService } from '../../../core/submission/workflowitem-data.service'; |
11 12 | import { RouterTestingModule } from '@angular/router/testing'; |
12 13 | import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub'; |
13 14 | import { WorkflowActionDataService } from '../../../core/data/workflow-action-data.service'; |
14 15 | import { NotificationsService } from '../../../shared/notifications/notifications.service'; |
15 16 | import { RouteService } from '../../../core/services/route.service'; |
16 17 | import { routeServiceStub } from '../../../shared/testing/route-service.stub'; |
17 18 | import { TranslateModule } from '@ngx-translate/core'; |
18 19 | import { WorkflowActionDataServiceStub } from '../../../shared/testing/workflow-action-data-service.stub'; |
19 20 | import { ProcessTaskResponse } from '../../../core/tasks/models/process-task-response'; |
20 21 | import { WorkflowItemDataServiceStub } from '../../../shared/testing/workflow-item-data-service.stub'; |
21 22 | import { RequestService } from '../../../core/data/request.service'; |
22 23 | import { RequestServiceStub } from '../../../shared/testing/request-service.stub'; |
24 + | import { LocationStub } from '../../../shared/testing/location.stub'; |
23 25 | |
24 26 | const workflowId = '1'; |
25 27 | |
26 28 | describe('AdvancedWorkflowActionComponent', () => { |
27 29 | let component: AdvancedWorkflowActionComponent; |
28 30 | let fixture: ComponentFixture<AdvancedWorkflowActionComponent>; |
29 31 | |
30 32 | let claimedTaskDataService: ClaimedTaskDataServiceStub; |
33 + | let location: LocationStub; |
31 34 | let notificationService: NotificationsServiceStub; |
32 35 | let workflowActionDataService: WorkflowActionDataServiceStub; |
33 36 | let workflowItemDataService: WorkflowItemDataServiceStub; |
34 37 | |
35 38 | beforeEach(async () => { |
36 39 | claimedTaskDataService = new ClaimedTaskDataServiceStub(); |
40 + | location = new LocationStub(); |
37 41 | notificationService = new NotificationsServiceStub(); |
38 42 | workflowActionDataService = new WorkflowActionDataServiceStub(); |
39 43 | workflowItemDataService = new WorkflowItemDataServiceStub(); |
40 44 | |
41 - | |
42 45 | await TestBed.configureTestingModule({ |
43 46 | imports: [ |
44 47 | TranslateModule.forRoot(), |
45 48 | RouterTestingModule, |
46 49 | ], |
47 50 | declarations: [ |
48 51 | TestComponent, |
49 52 | MockComponent(DSOSelectorComponent), |
50 53 | ], |
51 54 | providers: [ |
56 59 | id: workflowId, |
57 60 | }), |
58 61 | snapshot: { |
59 62 | queryParams: { |
60 63 | workflow: 'testaction', |
61 64 | }, |
62 65 | }, |
63 66 | }, |
64 67 | }, |
65 68 | { provide: ClaimedTaskDataService, useValue: claimedTaskDataService }, |
69 + | { provide: Location, useValue: location }, |
66 70 | { provide: NotificationsService, useValue: notificationService }, |
67 71 | { provide: RouteService, useValue: routeServiceStub }, |
68 72 | { provide: WorkflowActionDataService, useValue: workflowActionDataService }, |
69 73 | { provide: WorkflowItemDataService, useValue: workflowItemDataService }, |
70 74 | { provide: RequestService, useClass: RequestServiceStub }, |
71 75 | ], |
72 76 | }).compileComponents(); |
73 77 | }); |
74 78 | |
75 79 | beforeEach(() => { |