Commits
Yura Bondarenko authored d62d9b0f485
14 14 | import { RelationshipOptions } from '../../models/relationship-options.model'; |
15 15 | import { AddRelationshipAction, RemoveRelationshipAction } from './relationship.actions'; |
16 16 | import { SearchConfigurationService } from '../../../../../core/shared/search/search-configuration.service'; |
17 17 | import { PaginatedSearchOptions } from '../../../../search/paginated-search-options.model'; |
18 18 | import { ExternalSource } from '../../../../../core/shared/external-source.model'; |
19 19 | import { createSuccessfulRemoteDataObject$ } from '../../../../remote-data.utils'; |
20 20 | import { createPaginatedList } from '../../../../testing/utils.test'; |
21 21 | import { ExternalSourceService } from '../../../../../core/data/external-source.service'; |
22 22 | import { LookupRelationService } from '../../../../../core/data/lookup-relation.service'; |
23 23 | import { RemoteDataBuildService } from '../../../../../core/cache/builders/remote-data-build.service'; |
24 - | import { SubmissionService } from '../../../../../submission/submission.service'; |
25 - | import { SubmissionObjectDataService } from '../../../../../core/submission/submission-object-data.service'; |
26 24 | import { WorkspaceItem } from '../../../../../core/submission/models/workspaceitem.model'; |
27 25 | import { Collection } from '../../../../../core/shared/collection.model'; |
28 26 | |
29 27 | describe('DsDynamicLookupRelationModalComponent', () => { |
30 28 | let component: DsDynamicLookupRelationModalComponent; |
31 29 | let fixture: ComponentFixture<DsDynamicLookupRelationModalComponent>; |
32 30 | let item; |
33 31 | let item1; |
34 32 | let item2; |
35 33 | let testWSI; |
39 37 | let selection$; |
40 38 | let selectableListService; |
41 39 | let relationship; |
42 40 | let nameVariant; |
43 41 | let metadataField; |
44 42 | let pSearchOptions; |
45 43 | let externalSourceService; |
46 44 | let lookupRelationService; |
47 45 | let rdbService; |
48 46 | let submissionId; |
49 - | let submissionService; |
50 - | let submissionObjectDataService; |
51 47 | |
52 48 | const externalSources = [ |
53 49 | Object.assign(new ExternalSource(), { |
54 50 | id: 'orcidV2', |
55 51 | name: 'orcidV2', |
56 52 | hierarchical: false |
57 53 | }), |
58 54 | Object.assign(new ExternalSource(), { |
59 55 | id: 'sherpaPublisher', |
60 56 | name: 'sherpaPublisher', |
92 88 | findAll: createSuccessfulRemoteDataObject$(createPaginatedList(externalSources)), |
93 89 | findById: createSuccessfulRemoteDataObject$(externalSources[0]) |
94 90 | }); |
95 91 | lookupRelationService = jasmine.createSpyObj('lookupRelationService', { |
96 92 | getTotalLocalResults: observableOf(totalLocal), |
97 93 | getTotalExternalResults: observableOf(totalExternal) |
98 94 | }); |
99 95 | rdbService = jasmine.createSpyObj('rdbService', { |
100 96 | aggregate: createSuccessfulRemoteDataObject$(externalSources) |
101 97 | }); |
102 - | submissionService = jasmine.createSpyObj('SubmissionService', { |
103 - | dispatchSave: jasmine.createSpy('dispatchSave') |
104 - | }); |
105 - | submissionObjectDataService = jasmine.createSpyObj('SubmissionObjectDataService', { |
106 - | findById: createSuccessfulRemoteDataObject$(testWSI) |
107 - | }); |
108 98 | submissionId = '1234'; |
109 99 | } |
110 100 | |
111 101 | beforeEach(waitForAsync(() => { |
112 102 | init(); |
113 103 | TestBed.configureTestingModule({ |
114 104 | declarations: [DsDynamicLookupRelationModalComponent], |
115 105 | imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([]), NgbModule], |
116 106 | providers: [ |
117 107 | { |
122 112 | { provide: ExternalSourceService, useValue: externalSourceService }, |
123 113 | { provide: LookupRelationService, useValue: lookupRelationService }, |
124 114 | { |
125 115 | provide: SelectableListService, useValue: selectableListService |
126 116 | }, |
127 117 | { |
128 118 | provide: RelationshipService, useValue: { getNameVariant: () => observableOf(nameVariant) } |
129 119 | }, |
130 120 | { provide: RelationshipTypeService, useValue: {} }, |
131 121 | { provide: RemoteDataBuildService, useValue: rdbService }, |
132 - | { provide: SubmissionService, useValue: submissionService }, |
133 - | { provide: SubmissionObjectDataService, useValue: submissionObjectDataService }, |
134 122 | { |
135 123 | provide: Store, useValue: { |
136 124 | // tslint:disable-next-line:no-empty |
137 125 | dispatch: () => { |
138 126 | } |
139 127 | } |
140 128 | }, |
141 129 | { provide: NgZone, useValue: new NgZone({}) }, |
142 130 | NgbActiveModal |
143 131 | ], |