Commits
Tim Donohue authored and GitHub committed 20850033df3 Merge
36 36 | import { PaginatedSearchOptions } from '../../shared/search/models/paginated-search-options.model'; |
37 37 | import { |
38 38 | createFailedRemoteDataObject$, |
39 39 | createSuccessfulRemoteDataObject, |
40 40 | createSuccessfulRemoteDataObject$ |
41 41 | } from '../../shared/remote-data.utils'; |
42 42 | import { createPaginatedList } from '../../shared/testing/utils.test'; |
43 43 | import { AuthorizationDataService } from '../../core/data/feature-authorization/authorization-data.service'; |
44 44 | import { MyDSpacePageComponent, SEARCH_CONFIG_SERVICE } from '../../my-dspace-page/my-dspace-page.component'; |
45 45 | import { SearchConfigurationServiceStub } from '../../shared/testing/search-configuration-service.stub'; |
46 + | import { GroupDataService } from '../../core/eperson/group-data.service'; |
47 + | import { LinkHeadService } from '../../core/services/link-head.service'; |
48 + | import { ConfigurationDataService } from '../../core/data/configuration-data.service'; |
49 + | import { ConfigurationProperty } from '../../core/shared/configuration-property.model'; |
46 50 | |
47 51 | describe('CollectionItemMapperComponent', () => { |
48 52 | let comp: CollectionItemMapperComponent; |
49 53 | let fixture: ComponentFixture<CollectionItemMapperComponent>; |
50 54 | |
51 55 | let route: ActivatedRoute; |
52 56 | let router: Router; |
53 57 | let searchConfigService: SearchConfigurationService; |
54 58 | let searchService: SearchService; |
55 59 | let notificationsService: NotificationsService; |
136 140 | const fixedFilterServiceStub = { |
137 141 | getQueryByFilterName: () => { |
138 142 | return observableOf(''); |
139 143 | } |
140 144 | }; |
141 145 | |
142 146 | const authorizationDataService = jasmine.createSpyObj('authorizationDataService', { |
143 147 | isAuthorized: observableOf(true) |
144 148 | }); |
145 149 | |
150 + | const linkHeadService = jasmine.createSpyObj('linkHeadService', { |
151 + | addTag: '' |
152 + | }); |
153 + | |
154 + | const groupDataService = jasmine.createSpyObj('groupsDataService', { |
155 + | findAllByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])), |
156 + | getGroupRegistryRouterLink: '', |
157 + | getUUIDFromString: '', |
158 + | }); |
159 + | |
160 + | const configurationDataService = jasmine.createSpyObj('configurationDataService', { |
161 + | findByPropertyName: createSuccessfulRemoteDataObject$(Object.assign(new ConfigurationProperty(), { |
162 + | name: 'test', |
163 + | values: [ |
164 + | 'org.dspace.ctask.general.ProfileFormats = test' |
165 + | ] |
166 + | })) |
167 + | }); |
168 + | |
146 169 | beforeEach(waitForAsync(() => { |
147 170 | TestBed.configureTestingModule({ |
148 171 | imports: [CommonModule, FormsModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], |
149 172 | declarations: [CollectionItemMapperComponent, ItemSelectComponent, SearchFormComponent, PaginationComponent, EnumKeysPipe, VarDirective, ErrorComponent, LoadingComponent], |
150 173 | providers: [ |
151 174 | { provide: ActivatedRoute, useValue: activatedRouteStub }, |
152 175 | { provide: Router, useValue: routerStub }, |
153 176 | { provide: SearchConfigurationService, useValue: searchConfigServiceStub }, |
154 177 | { provide: SearchService, useValue: searchServiceStub }, |
155 178 | { provide: NotificationsService, useValue: new NotificationsServiceStub() }, |
156 179 | { provide: ItemDataService, useValue: itemDataServiceStub }, |
157 180 | { provide: CollectionDataService, useValue: collectionDataServiceStub }, |
158 181 | { provide: TranslateService, useValue: translateServiceStub }, |
159 182 | { provide: HostWindowService, useValue: new HostWindowServiceStub(0) }, |
160 183 | { provide: ObjectSelectService, useValue: new ObjectSelectServiceStub() }, |
161 184 | { provide: RouteService, useValue: routeServiceStub }, |
162 - | { provide: AuthorizationDataService, useValue: authorizationDataService } |
185 + | { provide: AuthorizationDataService, useValue: authorizationDataService }, |
186 + | { provide: GroupDataService, useValue: groupDataService }, |
187 + | { provide: LinkHeadService, useValue: linkHeadService }, |
188 + | { provide: ConfigurationDataService, useValue: configurationDataService }, |
163 189 | ] |
164 190 | }).overrideComponent(CollectionItemMapperComponent, { |
165 191 | set: { |
166 192 | providers: [ |
167 193 | { |
168 194 | provide: SEARCH_CONFIG_SERVICE, |
169 195 | useClass: SearchConfigurationServiceStub |
170 196 | } |
171 197 | ] } |
172 198 | }).compileComponents(); |