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