mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
[DURACOM-191] fix unit test with missing providers
This commit is contained in:
@@ -37,6 +37,7 @@ import { DSONameServiceMock, UNDEFINED_NAME } from '../../shared/mocks/dso-name.
|
||||
import { ActivatedRouteStub } from '../../shared/testing/active-router.stub';
|
||||
import { provideMockStore } from '@ngrx/store/testing';
|
||||
import { ConfigurationDataService } from '../../core/data/configuration-data.service';
|
||||
import { APP_DATA_SERVICES_MAP } from '../../../config/app-config.interface';
|
||||
|
||||
describe('GroupsRegistryComponent', () => {
|
||||
let component: GroupsRegistryComponent;
|
||||
@@ -191,6 +192,7 @@ describe('GroupsRegistryComponent', () => {
|
||||
{ provide: AuthorizationDataService, useValue: authorizationService },
|
||||
{ provide: PaginationService, useValue: paginationService },
|
||||
{ provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['removeByHrefSubstring']) },
|
||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||
provideMockStore(),
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
|
@@ -30,6 +30,7 @@ import { GroupDataService } from '../../../core/eperson/group-data.service';
|
||||
import { ConfigurationDataService } from '../../../core/data/configuration-data.service';
|
||||
import { Component, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { provideMockStore } from '@ngrx/store/testing';
|
||||
import { APP_DATA_SERVICES_MAP } from '../../../../config/app-config.interface';
|
||||
|
||||
describe('BitstreamFormatsComponent', () => {
|
||||
let comp: BitstreamFormatsComponent;
|
||||
@@ -120,6 +121,7 @@ describe('BitstreamFormatsComponent', () => {
|
||||
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule, BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe],
|
||||
providers: [
|
||||
provideMockStore(),
|
||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||
{provide: BitstreamFormatDataService, useValue: bitstreamFormatService},
|
||||
{provide: HostWindowService, useValue: new HostWindowServiceStub(0)},
|
||||
{provide: NotificationsService, useValue: notificationsServiceStub},
|
||||
|
@@ -1,13 +1,11 @@
|
||||
import { Component, OnInit, Inject, OnDestroy } from '@angular/core';
|
||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { VocabularyOptions } from '../../core/submission/vocabularies/models/vocabulary-options.model';
|
||||
import { VocabularyEntryDetail } from '../../core/submission/vocabularies/models/vocabulary-entry-detail.model';
|
||||
import { ActivatedRoute, RouterLink } from '@angular/router';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
import { BrowseDefinition } from '../../core/shared/browse-definition.model';
|
||||
import { GenericConstructor } from '../../core/shared/generic-constructor';
|
||||
import { BROWSE_BY_COMPONENT_FACTORY } from '../browse-by-switcher/browse-by-decorator';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { ThemeService } from 'src/app/shared/theme-support/theme.service';
|
||||
import { ThemeService } from '../../shared/theme-support/theme.service';
|
||||
import { HierarchicalBrowseDefinition } from '../../core/shared/hierarchical-browse-definition.model';
|
||||
import { VocabularyTreeviewComponent } from '../../shared/form/vocabulary-treeview/vocabulary-treeview.component';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
@@ -69,14 +67,12 @@ export class BrowseByTaxonomyPageComponent implements OnInit, OnDestroy {
|
||||
browseByComponentSubs: Subscription[] = [];
|
||||
|
||||
public constructor( protected route: ActivatedRoute,
|
||||
protected themeService: ThemeService,
|
||||
@Inject(BROWSE_BY_COMPONENT_FACTORY) private getComponentByBrowseByType: (browseByType, theme) => GenericConstructor<any>) {
|
||||
protected themeService: ThemeService) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.browseByComponent = this.route.data.pipe(
|
||||
map((data: { browseDefinition: BrowseDefinition }) => {
|
||||
this.getComponentByBrowseByType(data.browseDefinition.getRenderType(), this.themeService.getThemeName());
|
||||
return data.browseDefinition;
|
||||
})
|
||||
);
|
||||
|
@@ -12,12 +12,17 @@ import { Item } from '../../../core/shared/item.model';
|
||||
import { ItemTemplateDataService } from '../../../core/data/item-template-data.service';
|
||||
import { Collection } from '../../../core/shared/collection.model';
|
||||
import { RequestService } from '../../../core/data/request.service';
|
||||
import { createFailedRemoteDataObject$, createSuccessfulRemoteDataObject, createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
||||
import {
|
||||
createFailedRemoteDataObject$,
|
||||
createSuccessfulRemoteDataObject,
|
||||
createSuccessfulRemoteDataObject$
|
||||
} from '../../../shared/remote-data.utils';
|
||||
import { getCollectionItemTemplateRoute } from '../../collection-page-routing-paths';
|
||||
import { AuthServiceMock } from '../../../shared/mocks/auth.service.mock';
|
||||
import { AuthService } from '../../../core/auth/auth.service';
|
||||
import { CommunityDataService } from '../../../core/data/community-data.service';
|
||||
import { ObjectCacheService } from '../../../core/cache/object-cache.service';
|
||||
import { APP_DATA_SERVICES_MAP } from '../../../../config/app-config.interface';
|
||||
|
||||
describe('CollectionMetadataComponent', () => {
|
||||
let comp: CollectionMetadataComponent;
|
||||
@@ -73,6 +78,7 @@ describe('CollectionMetadataComponent', () => {
|
||||
{ provide: AuthService, useValue: new AuthServiceMock() },
|
||||
{ provide: CommunityDataService, useValue: {} },
|
||||
{ provide: ObjectCacheService, useValue: {} },
|
||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).compileComponents();
|
||||
|
@@ -11,6 +11,7 @@ import { isEmpty } from 'rxjs/operators';
|
||||
import { FindListOptions } from '../../data/find-list-options.model';
|
||||
import { DATA_SERVICE_FACTORY } from '../../data/base/data-service.decorator';
|
||||
import { of } from 'rxjs';
|
||||
import { APP_DATA_SERVICES_MAP } from '../../../../config/app-config.interface';
|
||||
|
||||
const TEST_MODEL = new ResourceType('authorization');
|
||||
let result: any;
|
||||
@@ -48,6 +49,9 @@ let testDataService: TestDataService = new TestDataService();
|
||||
|
||||
let testModel: TestModel;
|
||||
|
||||
const mockMap = {
|
||||
[TEST_MODEL.value]: () => new Promise((resolve) => resolve(TestDataService))
|
||||
};
|
||||
describe('LinkService', () => {
|
||||
let service: LinkService;
|
||||
beforeEach(() => {
|
||||
@@ -95,6 +99,9 @@ describe('LinkService', () => {
|
||||
propertyName: 'successor',
|
||||
}
|
||||
]),
|
||||
}, {
|
||||
provide: APP_DATA_SERVICES_MAP,
|
||||
useValue: mockMap
|
||||
}]
|
||||
});
|
||||
service = TestBed.inject(LinkService);
|
||||
|
@@ -13,17 +13,19 @@ import { of as observableOf } from 'rxjs';
|
||||
import { MockBitstreamFormat1 } from '../../../../shared/mocks/item.mock';
|
||||
import { FileSizePipe } from '../../../../shared/utils/file-size-pipe';
|
||||
import { PageInfo } from '../../../../core/shared/page-info.model';
|
||||
import { MetadataFieldWrapperComponent } from '../../../../shared/metadata-field-wrapper/metadata-field-wrapper.component';
|
||||
import {
|
||||
MetadataFieldWrapperComponent
|
||||
} from '../../../../shared/metadata-field-wrapper/metadata-field-wrapper.component';
|
||||
import { createPaginatedList } from '../../../../shared/testing/utils.test';
|
||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||
import { NotificationsServiceStub } from '../../../../shared/testing/notifications-service.stub';
|
||||
import { APP_CONFIG } from './../../../../../config/app-config.interface';
|
||||
import { environment } from './../.././../../../environments/environment';
|
||||
import { ThemeService } from './../.././../../shared/theme-support/theme.service';
|
||||
import { getMockThemeService } from './../.././../../shared/mocks/theme-service.mock';
|
||||
import { APP_CONFIG, APP_DATA_SERVICES_MAP } from '../../../../../config/app-config.interface';
|
||||
import { environment } from '../../../../../environments/environment';
|
||||
import { ThemeService } from '../../../../shared/theme-support/theme.service';
|
||||
import { getMockThemeService } from '../../../../shared/mocks/theme-service.mock';
|
||||
import { provideMockStore } from '@ngrx/store/testing';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ActivatedRouteStub } from './../.././../../shared/testing/active-router.stub';
|
||||
import { ActivatedRouteStub } from '../../../../shared/testing/active-router.stub';
|
||||
|
||||
describe('FileSectionComponent', () => {
|
||||
let comp: FileSectionComponent;
|
||||
@@ -70,6 +72,7 @@ describe('FileSectionComponent', () => {
|
||||
}
|
||||
}), BrowserAnimationsModule, FileSectionComponent, VarDirective, FileSizePipe],
|
||||
providers: [
|
||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||
{ provide: BitstreamDataService, useValue: bitstreamDataService },
|
||||
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
|
||||
{ provide: APP_CONFIG, useValue: environment },
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
@@ -10,6 +10,7 @@ import { ActivatedRouteStub } from '../shared/testing/active-router.stub';
|
||||
import { AuthService } from '../core/auth/auth.service';
|
||||
import { AuthServiceMock } from '../shared/mocks/auth.service.mock';
|
||||
import { provideMockStore } from '@ngrx/store/testing';
|
||||
import { APP_DATA_SERVICES_MAP } from '../../config/app-config.interface';
|
||||
|
||||
describe('LoginPageComponent', () => {
|
||||
let comp: LoginPageComponent;
|
||||
@@ -27,6 +28,7 @@ describe('LoginPageComponent', () => {
|
||||
providers: [
|
||||
{ provide: ActivatedRoute, useValue: activatedRouteStub },
|
||||
{ provide: AuthService, useValue: new AuthServiceMock() },
|
||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||
provideMockStore({})
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
|
@@ -29,7 +29,7 @@ import { EPersonMock } from '../shared/testing/eperson.mock';
|
||||
import { FlatBrowseDefinition } from '../core/shared/flat-browse-definition.model';
|
||||
import { ValueListBrowseDefinition } from '../core/shared/value-list-browse-definition.model';
|
||||
import { HierarchicalBrowseDefinition } from '../core/shared/hierarchical-browse-definition.model';
|
||||
import { BrowseByDataType } from '../browse-by/browse-by-data-type';
|
||||
import { BrowseByDataType } from '../browse-by/browse-by-switcher/browse-by-data-type';
|
||||
|
||||
let comp: NavbarComponent;
|
||||
let fixture: ComponentFixture<NavbarComponent>;
|
||||
|
@@ -17,6 +17,7 @@ import { AuthService } from '../../core/auth/auth.service';
|
||||
import { of } from 'rxjs';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ActivatedRouteStub } from '../testing/active-router.stub';
|
||||
import { APP_DATA_SERVICES_MAP } from '../../../config/app-config.interface';
|
||||
|
||||
describe('AuthNavMenuComponent', () => {
|
||||
|
||||
@@ -80,6 +81,7 @@ describe('AuthNavMenuComponent', () => {
|
||||
AuthNavMenuComponent
|
||||
],
|
||||
providers: [
|
||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||
{ provide: HostWindowService, useValue: window },
|
||||
{ provide: AuthService, useValue: authService },
|
||||
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() },
|
||||
@@ -87,7 +89,7 @@ describe('AuthNavMenuComponent', () => {
|
||||
schemas: [
|
||||
CUSTOM_ELEMENTS_SCHEMA
|
||||
]
|
||||
})
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
@@ -279,7 +281,7 @@ describe('AuthNavMenuComponent', () => {
|
||||
schemas: [
|
||||
CUSTOM_ELEMENTS_SCHEMA
|
||||
]
|
||||
})
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
}));
|
||||
|
@@ -16,6 +16,7 @@ import { AuthService } from '../../../core/auth/auth.service';
|
||||
import { of } from 'rxjs';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ActivatedRouteStub } from '../../testing/active-router.stub';
|
||||
import { APP_DATA_SERVICES_MAP } from '../../../../config/app-config.interface';
|
||||
|
||||
describe('UserMenuComponent', () => {
|
||||
|
||||
@@ -74,6 +75,7 @@ describe('UserMenuComponent', () => {
|
||||
providers: [
|
||||
{ provide: AuthService, useValue: authService },
|
||||
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() },
|
||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||
],
|
||||
schemas: [
|
||||
NO_ERRORS_SCHEMA
|
||||
|
@@ -79,7 +79,11 @@ import { FormService } from '../../form.service';
|
||||
import { SubmissionService } from '../../../../submission/submission.service';
|
||||
import { FormBuilderService } from '../form-builder.service';
|
||||
import { NgxMaskModule } from 'ngx-mask';
|
||||
import { APP_CONFIG } from '../../../../../config/app-config.interface';
|
||||
import {
|
||||
APP_CONFIG,
|
||||
APP_DATA_SERVICES_MAP,
|
||||
APP_DYNAMIC_FORM_CONTROL_FN
|
||||
} from '../../../../../config/app-config.interface';
|
||||
import { environment } from '../../../../../environments/environment';
|
||||
import { dsDynamicFormControlMapFn } from './ds-dynamic-form-control-map-fn';
|
||||
|
||||
@@ -235,7 +239,9 @@ describe('DsDynamicFormControlContainerComponent test suite', () => {
|
||||
}
|
||||
},
|
||||
{ provide: NgZone, useValue: new NgZone({}) },
|
||||
{ provide: APP_CONFIG, useValue: environment }
|
||||
{ provide: APP_CONFIG, useValue: environment },
|
||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||
{ provide: APP_DYNAMIC_FORM_CONTROL_FN, useValue: dsDynamicFormControlMapFn },
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
}).compileComponents().then(() => {
|
||||
@@ -244,6 +250,7 @@ describe('DsDynamicFormControlContainerComponent test suite', () => {
|
||||
|
||||
const ngZone = TestBed.inject(NgZone);
|
||||
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
spyOn(ngZone, 'runOutsideAngular').and.callFake((fn: Function) => fn());
|
||||
component = fixture.componentInstance;
|
||||
|
@@ -25,10 +25,11 @@ import { FormRowModel } from '../../../../../../core/config/models/config-submis
|
||||
import { DsDynamicTypeBindRelationService } from '../../ds-dynamic-type-bind-relation.service';
|
||||
import { SubmissionObjectDataService } from '../../../../../../core/submission/submission-object-data.service';
|
||||
import { SubmissionService } from '../../../../../../submission/submission.service';
|
||||
import { APP_CONFIG } from 'src/config/app-config.interface';
|
||||
import { APP_CONFIG, APP_DATA_SERVICES_MAP, APP_DYNAMIC_FORM_CONTROL_FN } from 'src/config/app-config.interface';
|
||||
import { environment } from 'src/environments/environment.test';
|
||||
import { AsyncPipe, NgClass, NgIf } from '@angular/common';
|
||||
import { provideMockStore } from '@ngrx/store/testing';
|
||||
import { dsDynamicFormControlMapFn } from '../../ds-dynamic-form-control-map-fn';
|
||||
|
||||
export let FORM_GROUP_TEST_MODEL_CONFIG;
|
||||
|
||||
@@ -150,6 +151,8 @@ describe('DsDynamicRelationGroupComponent test suite', () => {
|
||||
{ provide: SubmissionObjectDataService, useValue: {}},
|
||||
{ provide: SubmissionService, useValue: {}},
|
||||
{ provide: APP_CONFIG, useValue: environment },
|
||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||
{ provide: APP_DYNAMIC_FORM_CONTROL_FN, useValue: dsDynamicFormControlMapFn },
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
})
|
||||
|
@@ -25,6 +25,7 @@ import { WorkspaceItem } from '../../../../../core/submission/models/workspaceit
|
||||
import { Collection } from '../../../../../core/shared/collection.model';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { provideMockStore } from '@ngrx/store/testing';
|
||||
import { APP_DATA_SERVICES_MAP } from '../../../../../../config/app-config.interface';
|
||||
|
||||
describe('DsDynamicLookupRelationModalComponent', () => {
|
||||
let component: DsDynamicLookupRelationModalComponent;
|
||||
@@ -129,6 +130,7 @@ describe('DsDynamicLookupRelationModalComponent', () => {
|
||||
}
|
||||
},
|
||||
{ provide: NgZone, useValue: new NgZone({}) },
|
||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||
NgbActiveModal,
|
||||
provideMockStore()
|
||||
],
|
||||
|
@@ -25,6 +25,7 @@ import { createTestComponent } from '../testing/utils.test';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { storeModuleConfig } from '../../app.reducer';
|
||||
import { DsDynamicFormComponent } from './builder/ds-dynamic-form-ui/ds-dynamic-form.component';
|
||||
import { APP_DATA_SERVICES_MAP } from '../../../config/app-config.interface';
|
||||
|
||||
let TEST_FORM_MODEL;
|
||||
|
||||
@@ -149,6 +150,7 @@ describe('FormComponent test suite', () => {
|
||||
TestComponent,
|
||||
],
|
||||
providers: [
|
||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||
ChangeDetectorRef,
|
||||
DynamicFormValidationService,
|
||||
FormBuilderService,
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* eslint-disable max-classes-per-file */
|
||||
/* eslint-disable max-classes-per-file */
|
||||
import { getComponentByWorkflowTaskOption, rendersWorkflowTaskOption } from './claimed-task-actions-decorator';
|
||||
|
||||
describe('ClaimedTaskActions decorator function', () => {
|
||||
@@ -26,13 +26,13 @@ describe('ClaimedTaskActions decorator function', () => {
|
||||
describe('If there\'s an exact match', () => {
|
||||
it('should return the matching class', () => {
|
||||
const component = getComponentByWorkflowTaskOption(option1);
|
||||
expect(component).toEqual(Test1Action);
|
||||
expect(component).toEqual(Test1Action as any);
|
||||
|
||||
const component2 = getComponentByWorkflowTaskOption(option2);
|
||||
expect(component2).toEqual(Test2Action);
|
||||
expect(component2).toEqual(Test2Action as any);
|
||||
|
||||
const component3 = getComponentByWorkflowTaskOption(option3);
|
||||
expect(component3).toEqual(Test3Action);
|
||||
expect(component3).toEqual(Test3Action as any);
|
||||
});
|
||||
});
|
||||
|
||||
|
@@ -89,13 +89,13 @@ export function rendersAdvancedWorkflowTaskOption(option: string) {
|
||||
/**
|
||||
* Get the component used for rendering a ClaimedTaskActions page by option type
|
||||
*/
|
||||
export function getComponentByWorkflowTaskOption(option: string) {
|
||||
export function getComponentByWorkflowTaskOption(option: string): WorkflowTaskOptionComponent {
|
||||
return WORKFLOW_TASK_OPTION_DECORATOR_MAP.get(option);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the component used for rendering a AdvancedClaimedTaskActions page by option type
|
||||
*/
|
||||
export function getAdvancedComponentByWorkflowTaskOption(option: string) {
|
||||
export function getAdvancedComponentByWorkflowTaskOption(option: string): AdvancedWorkflowTaskOptionComponent {
|
||||
return ADVANCED_WORKFLOW_TASK_OPTION_DECORATOR_MAP.get(option);
|
||||
}
|
||||
|
@@ -13,7 +13,7 @@ import { TranslateModule } from '@ngx-translate/core';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { provideMockStore } from '@ngrx/store/testing';
|
||||
import { ThemeService } from '../../../theme-support/theme.service';
|
||||
import { APP_CONFIG } from '../../../../../config/app-config.interface';
|
||||
import { APP_CONFIG, APP_DATA_SERVICES_MAP } from '../../../../../config/app-config.interface';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { of } from 'rxjs';
|
||||
import { REQUEST } from '@nguniversal/express-engine/tokens';
|
||||
@@ -65,7 +65,8 @@ describe('ListableObjectComponentLoaderComponent', () => {
|
||||
},
|
||||
provideMockStore({}),
|
||||
{ provide: ThemeService, useValue: getMockThemeService('dspace') },
|
||||
{ provide: APP_CONFIG, useValue: { browseBy: { showThumbnails: true } } }
|
||||
{ provide: APP_CONFIG, useValue: { browseBy: { showThumbnails: true } } },
|
||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||
]
|
||||
}).overrideComponent(ListableObjectComponentLoaderComponent, {
|
||||
set: {
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
import { Component, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { CommonModule} from '@angular/common';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||
|
||||
@@ -37,13 +37,16 @@ import { RouterMock } from '../../mocks/router.mock';
|
||||
import { PaginationServiceStub } from '../../testing/pagination-service.stub';
|
||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { DsDynamicTypeBindRelationService } from '../../form/builder/ds-dynamic-form-ui/ds-dynamic-type-bind-relation.service';
|
||||
import { SubmissionObjectDataService } from './../../../core/submission/submission-object-data.service';
|
||||
import { SubmissionService } from './../../../submission/submission.service';
|
||||
import { APP_CONFIG } from 'src/config/app-config.interface';
|
||||
import {
|
||||
DsDynamicTypeBindRelationService
|
||||
} from '../../form/builder/ds-dynamic-form-ui/ds-dynamic-type-bind-relation.service';
|
||||
import { SubmissionObjectDataService } from '../../../core/submission/submission-object-data.service';
|
||||
import { SubmissionService } from '../../../submission/submission.service';
|
||||
import { APP_CONFIG, APP_DATA_SERVICES_MAP, APP_DYNAMIC_FORM_CONTROL_FN } from 'src/config/app-config.interface';
|
||||
import { environment } from 'src/environments/environment.test';
|
||||
import { NgxMaskModule } from 'ngx-mask';
|
||||
import { provideMockStore } from '@ngrx/store/testing';
|
||||
import { dsDynamicFormControlMapFn } from '../../form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-map-fn';
|
||||
|
||||
export const mockResourcePolicyFormData = {
|
||||
name: [
|
||||
@@ -208,6 +211,8 @@ describe('ResourcePolicyFormComponent test suite', () => {
|
||||
{ provide: SubmissionObjectDataService, useValue: {} },
|
||||
{ provide: SubmissionService, useValue: {} },
|
||||
{ provide: APP_CONFIG, useValue: environment },
|
||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||
{ provide: APP_DYNAMIC_FORM_CONTROL_FN, useValue: dsDynamicFormControlMapFn },
|
||||
provideMockStore({})
|
||||
],
|
||||
schemas: [
|
||||
|
@@ -39,6 +39,7 @@ import { ThemedSearchSidebarComponent } from './search-sidebar/themed-search-sid
|
||||
import { ThemedSearchFormComponent } from '../search-form/themed-search-form.component';
|
||||
import { SearchLabelsComponent } from './search-labels/search-labels.component';
|
||||
import { SEARCH_CONFIG_SERVICE } from '../../my-dspace-page/my-dspace-configuration.service';
|
||||
import { APP_DATA_SERVICES_MAP } from '../../../config/app-config.interface';
|
||||
|
||||
let comp: SearchComponent;
|
||||
let fixture: ComponentFixture<SearchComponent>;
|
||||
@@ -229,7 +230,8 @@ export function configureSearchComponentTestingModule(compType, additionalDeclar
|
||||
{
|
||||
provide: SEARCH_CONFIG_SERVICE,
|
||||
useValue: searchConfigurationServiceStub
|
||||
}
|
||||
},
|
||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(compType, {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { waitForAsync, ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing';
|
||||
import { ComponentFixture, fakeAsync, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
@@ -17,7 +17,9 @@ import { ActivatedRouteStub } from '../../shared/testing/active-router.stub';
|
||||
import { mockSubmissionObject } from '../../shared/mocks/submission.mock';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
||||
import { ItemDataService } from '../../core/data/item-data.service';
|
||||
import { SubmissionJsonPatchOperationsServiceStub } from '../../shared/testing/submission-json-patch-operations-service.stub';
|
||||
import {
|
||||
SubmissionJsonPatchOperationsServiceStub
|
||||
} from '../../shared/testing/submission-json-patch-operations-service.stub';
|
||||
import { SubmissionJsonPatchOperationsService } from '../../core/submission/submission-json-patch-operations.service';
|
||||
import { AuthServiceStub } from '../../shared/testing/auth-service.stub';
|
||||
import { AuthService } from '../../core/auth/auth.service';
|
||||
@@ -27,6 +29,7 @@ import { SectionsServiceStub } from '../../shared/testing/sections-service.stub'
|
||||
import { ThemeService } from '../../shared/theme-support/theme.service';
|
||||
import { getMockThemeService } from '../../shared/mocks/theme-service.mock';
|
||||
import { provideMockStore } from '@ngrx/store/testing';
|
||||
import { APP_DATA_SERVICES_MAP } from '../../../config/app-config.interface';
|
||||
|
||||
describe('SubmissionEditComponent Component', () => {
|
||||
|
||||
@@ -73,6 +76,7 @@ describe('SubmissionEditComponent Component', () => {
|
||||
{ provide: HALEndpointService, useValue: halService },
|
||||
{ provide: SectionsService, useValue: new SectionsServiceStub() },
|
||||
{ provide: ThemeService, useValue: themeService },
|
||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||
provideMockStore()
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
|
@@ -39,12 +39,17 @@ import { getMockFormService } from '../../../shared/mocks/form-service.mock';
|
||||
import { mockAccessesFormData } from '../../../shared/mocks/submission.mock';
|
||||
import { accessConditionChangeEvent, checkboxChangeEvent } from '../../../shared/testing/form-event.stub';
|
||||
import { provideMockStore } from '@ngrx/store/testing';
|
||||
import { DsDynamicTypeBindRelationService } from '../../../shared/form/builder/ds-dynamic-form-ui/ds-dynamic-type-bind-relation.service';
|
||||
import {
|
||||
DsDynamicTypeBindRelationService
|
||||
} from '../../../shared/form/builder/ds-dynamic-form-ui/ds-dynamic-type-bind-relation.service';
|
||||
import { SubmissionObjectDataService } from '../../../core/submission/submission-object-data.service';
|
||||
import { SubmissionService } from '../../submission.service';
|
||||
import { APP_CONFIG } from 'src/config/app-config.interface';
|
||||
import { APP_CONFIG, APP_DATA_SERVICES_MAP, APP_DYNAMIC_FORM_CONTROL_FN } from 'src/config/app-config.interface';
|
||||
import { environment } from 'src/environments/environment.test';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import {
|
||||
dsDynamicFormControlMapFn
|
||||
} from '../../../shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-map-fn';
|
||||
|
||||
function getMockDsDynamicTypeBindRelationService(): DsDynamicTypeBindRelationService {
|
||||
return jasmine.createSpyObj('DsDynamicTypeBindRelationService', {
|
||||
@@ -116,6 +121,8 @@ describe('SubmissionSectionAccessesComponent', () => {
|
||||
{ provide: SubmissionObjectDataService, useValue: {} },
|
||||
{ provide: SubmissionService, useValue: {} },
|
||||
{ provide: APP_CONFIG, useValue: environment },
|
||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||
{ provide: APP_DYNAMIC_FORM_CONTROL_FN, useValue: dsDynamicFormControlMapFn },
|
||||
FormBuilderService,
|
||||
provideMockStore({})
|
||||
]
|
||||
@@ -134,7 +141,6 @@ describe('SubmissionSectionAccessesComponent', () => {
|
||||
fixture.detectChanges();
|
||||
}));
|
||||
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
@@ -187,8 +193,6 @@ describe('SubmissionSectionAccessesComponent', () => {
|
||||
|
||||
describe('when canDescoverable is false', () => {
|
||||
|
||||
|
||||
|
||||
beforeEach(async () => {
|
||||
formService = getMockFormService();
|
||||
await TestBed.configureTestingModule({
|
||||
@@ -213,6 +217,8 @@ describe('SubmissionSectionAccessesComponent', () => {
|
||||
{ provide: SubmissionObjectDataService, useValue: {} },
|
||||
{ provide: SubmissionService, useValue: {} },
|
||||
{ provide: APP_CONFIG, useValue: environment },
|
||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||
{ provide: APP_DYNAMIC_FORM_CONTROL_FN, useValue: dsDynamicFormControlMapFn },
|
||||
FormBuilderService,
|
||||
provideMockStore({})
|
||||
|
||||
|
@@ -29,7 +29,10 @@ import {
|
||||
} from '../../../shared/mocks/form-models.mock';
|
||||
import { FormFieldMetadataValueObject } from '../../../shared/form/builder/models/form-field-metadata-value.model';
|
||||
import { VocabularyEntry } from '../../../core/submission/vocabularies/models/vocabulary-entry.model';
|
||||
import { DynamicRowArrayModel } from '../../../shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-array-model';
|
||||
import {
|
||||
DynamicRowArrayModel
|
||||
} from '../../../shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-array-model';
|
||||
import { APP_DATA_SERVICES_MAP } from '../../../../config/app-config.interface';
|
||||
|
||||
describe('SectionFormOperationsService test suite', () => {
|
||||
let formBuilderService: any;
|
||||
@@ -74,6 +77,7 @@ describe('SectionFormOperationsService test suite', () => {
|
||||
providers: [
|
||||
{ provide: FormBuilderService, useValue: getMockFormBuilderService() },
|
||||
{ provide: JsonPatchOperationsBuilder, useValue: jsonPatchOpBuilder },
|
||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||
SectionFormOperationsService
|
||||
]
|
||||
}).compileComponents().then();
|
||||
|
@@ -38,9 +38,14 @@ import { License } from '../../../core/shared/license.model';
|
||||
import { FormFieldMetadataValueObject } from '../../../shared/form/builder/models/form-field-metadata-value.model';
|
||||
import { cold } from 'jasmine-marbles';
|
||||
import { provideMockStore } from '@ngrx/store/testing';
|
||||
import { DsDynamicTypeBindRelationService } from 'src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-type-bind-relation.service';
|
||||
import { APP_CONFIG } from 'src/config/app-config.interface';
|
||||
import {
|
||||
DsDynamicTypeBindRelationService
|
||||
} from 'src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-type-bind-relation.service';
|
||||
import { APP_CONFIG, APP_DATA_SERVICES_MAP, APP_DYNAMIC_FORM_CONTROL_FN } from 'src/config/app-config.interface';
|
||||
import { environment } from 'src/environments/environment.test';
|
||||
import {
|
||||
dsDynamicFormControlMapFn
|
||||
} from '../../../shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-map-fn';
|
||||
|
||||
function getMockDsDynamicTypeBindRelationService(): DsDynamicTypeBindRelationService {
|
||||
return jasmine.createSpyObj('DsDynamicTypeBindRelationService', {
|
||||
@@ -158,6 +163,8 @@ describe('SubmissionSectionLicenseComponent test suite', () => {
|
||||
FormBuilderService,
|
||||
{ provide: DsDynamicTypeBindRelationService, useValue: getMockDsDynamicTypeBindRelationService() },
|
||||
{ provide: APP_CONFIG, useValue: environment },
|
||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||
{ provide: APP_DYNAMIC_FORM_CONTROL_FN, useValue: dsDynamicFormControlMapFn },
|
||||
SubmissionSectionLicenseComponent
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
|
@@ -21,6 +21,7 @@ import { MetadataInformationComponent } from './metadata-information/metadata-in
|
||||
import { AlertComponent } from '../../../shared/alert/alert.component';
|
||||
import { PublisherPolicyComponent } from './publisher-policy/publisher-policy.component';
|
||||
import { PublicationInformationComponent } from './publication-information/publication-information.component';
|
||||
import { APP_DATA_SERVICES_MAP } from '../../../../config/app-config.interface';
|
||||
|
||||
describe('SubmissionSectionSherpaPoliciesComponent', () => {
|
||||
let component: SubmissionSectionSherpaPoliciesComponent;
|
||||
@@ -74,6 +75,7 @@ describe('SubmissionSectionSherpaPoliciesComponent', () => {
|
||||
{ provide: Store, useValue: storeStub },
|
||||
{ provide: 'sectionDataProvider', useValue: sectionData },
|
||||
{ provide: 'submissionIdProvider', useValue: '1508' },
|
||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||
]
|
||||
})
|
||||
.overrideComponent(SubmissionSectionSherpaPoliciesComponent, {
|
||||
|
@@ -49,7 +49,7 @@ import { provideMockStore } from '@ngrx/store/testing';
|
||||
import {
|
||||
DsDynamicTypeBindRelationService
|
||||
} from '../../../../../shared/form/builder/ds-dynamic-form-ui/ds-dynamic-type-bind-relation.service';
|
||||
import { APP_CONFIG } from '../../../../../../config/app-config.interface';
|
||||
import { APP_CONFIG, APP_DATA_SERVICES_MAP } from '../../../../../../config/app-config.interface';
|
||||
import { environment } from '../../../../../../environments/environment.test';
|
||||
import { NgxMaskModule } from 'ngx-mask';
|
||||
import { POLICY_DEFAULT_WITH_LIST } from '../../section-upload-constants';
|
||||
@@ -140,6 +140,7 @@ describe('SubmissionSectionUploadFileEditComponent test suite', () => {
|
||||
NgbActiveModal,
|
||||
{ provide: DsDynamicTypeBindRelationService, useValue: getMockDsDynamicTypeBindRelationService() },
|
||||
{ provide: APP_CONFIG, useValue: environment },
|
||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).compileComponents().then();
|
||||
|
@@ -12,8 +12,12 @@ import { HALEndpointService } from '../../../../core/shared/hal-endpoint.service
|
||||
import { HALEndpointServiceStub } from '../../../../shared/testing/hal-endpoint-service.stub';
|
||||
import { NgbModal, NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { JsonPatchOperationsBuilder } from '../../../../core/json-patch/builder/json-patch-operations-builder';
|
||||
import { SubmissionJsonPatchOperationsServiceStub } from '../../../../shared/testing/submission-json-patch-operations-service.stub';
|
||||
import { SubmissionJsonPatchOperationsService } from '../../../../core/submission/submission-json-patch-operations.service';
|
||||
import {
|
||||
SubmissionJsonPatchOperationsServiceStub
|
||||
} from '../../../../shared/testing/submission-json-patch-operations-service.stub';
|
||||
import {
|
||||
SubmissionJsonPatchOperationsService
|
||||
} from '../../../../core/submission/submission-json-patch-operations.service';
|
||||
import { SubmissionSectionUploadFileComponent } from './section-upload-file.component';
|
||||
import { SubmissionServiceStub } from '../../../../shared/testing/submission-service.stub';
|
||||
import {
|
||||
@@ -35,7 +39,7 @@ import { SubmissionSectionUploadFileViewComponent } from './view/section-upload-
|
||||
import { ThemeService } from '../../../../shared/theme-support/theme.service';
|
||||
import { getMockThemeService } from '../../../../shared/mocks/theme-service.mock';
|
||||
import { POLICY_DEFAULT_WITH_LIST } from '../section-upload-constants';
|
||||
|
||||
import { APP_DATA_SERVICES_MAP } from '../../../../../config/app-config.interface';
|
||||
|
||||
|
||||
const configMetadataFormMock = {
|
||||
@@ -97,6 +101,7 @@ describe('SubmissionSectionUploadFileComponent test suite', () => {
|
||||
{ provide: SubmissionService, useClass: SubmissionServiceStub },
|
||||
{ provide: SectionUploadService, useValue: getMockSectionUploadService() },
|
||||
{ provide: ThemeService, useValue: getMockThemeService() },
|
||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||
ChangeDetectorRef,
|
||||
NgbModal,
|
||||
SubmissionSectionUploadFileComponent,
|
||||
|
@@ -41,6 +41,7 @@ import { PageInfo } from '../../../core/shared/page-info.model';
|
||||
import { AlertComponent } from '../../../shared/alert/alert.component';
|
||||
import { ThemeService } from '../../../shared/theme-support/theme.service';
|
||||
import { getMockThemeService } from '../../../shared/mocks/theme-service.mock';
|
||||
import { APP_DATA_SERVICES_MAP } from '../../../../config/app-config.interface';
|
||||
|
||||
function getMockSubmissionUploadsConfigService(): SubmissionFormsConfigDataService {
|
||||
return jasmine.createSpyObj('SubmissionUploadsConfigService', {
|
||||
@@ -182,6 +183,7 @@ describe('SubmissionSectionUploadComponent test suite', () => {
|
||||
{ provide: 'sectionDataProvider', useValue: sectionObject },
|
||||
{ provide: 'submissionIdProvider', useValue: submissionId },
|
||||
{ provide: ThemeService, useValue: getMockThemeService()},
|
||||
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||
ChangeDetectorRef,
|
||||
SubmissionSectionUploadComponent
|
||||
],
|
||||
|
Reference in New Issue
Block a user