mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-10 11:33:04 +00:00
fix broken tests
This commit is contained in:
@@ -10,6 +10,8 @@ import { TruncatableService } from '../../../../../shared/truncatable/truncatabl
|
||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||
import { APP_CONFIG } from '../../../../../../config/app-config.interface';
|
||||
import { ThemeService } from '../../../../../shared/theme-support/theme.service';
|
||||
import { getMockThemeService } from '../../../../../shared/mocks/theme-service.mock';
|
||||
|
||||
let journalIssueListElementComponent: JournalIssueSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<JournalIssueSearchResultListElementComponent>;
|
||||
@@ -77,7 +79,8 @@ describe('JournalIssueSearchResultListElementComponent', () => {
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||
{ provide: APP_CONFIG, useValue: environmentUseThumbs }
|
||||
{ provide: APP_CONFIG, useValue: environmentUseThumbs },
|
||||
{ provide: ThemeService, useValue: getMockThemeService() }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(JournalIssueSearchResultListElementComponent, {
|
||||
@@ -164,7 +167,8 @@ describe('JournalIssueSearchResultListElementComponent', () => {
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||
{ provide: APP_CONFIG, useValue: enviromentNoThumbs }
|
||||
{ provide: APP_CONFIG, useValue: enviromentNoThumbs },
|
||||
{ provide: ThemeService, useValue: getMockThemeService() }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(JournalIssueSearchResultListElementComponent, {
|
||||
|
@@ -10,6 +10,8 @@ import { TruncatableService } from '../../../../../shared/truncatable/truncatabl
|
||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||
import { APP_CONFIG } from '../../../../../../config/app-config.interface';
|
||||
import { ThemeService } from '../../../../../shared/theme-support/theme.service';
|
||||
import { getMockThemeService } from '../../../../../shared/mocks/theme-service.mock';
|
||||
|
||||
let journalVolumeListElementComponent: JournalVolumeSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<JournalVolumeSearchResultListElementComponent>;
|
||||
@@ -76,7 +78,8 @@ describe('JournalVolumeSearchResultListElementComponent', () => {
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||
{ provide: APP_CONFIG, useValue: environmentUseThumbs }
|
||||
{ provide: APP_CONFIG, useValue: environmentUseThumbs },
|
||||
{ provide: ThemeService, useValue: getMockThemeService() }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(JournalVolumeSearchResultListElementComponent, {
|
||||
@@ -162,7 +165,8 @@ describe('JournalVolumeSearchResultListElementComponent', () => {
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||
{ provide: APP_CONFIG, useValue: enviromentNoThumbs }
|
||||
{ provide: APP_CONFIG, useValue: enviromentNoThumbs },
|
||||
{ provide: ThemeService, useValue: getMockThemeService() }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(JournalVolumeSearchResultListElementComponent, {
|
||||
|
@@ -10,6 +10,8 @@ import { ItemSearchResult } from '../../../../../shared/object-collection/shared
|
||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||
import { APP_CONFIG } from '../../../../../../config/app-config.interface';
|
||||
import { ThemeService } from '../../../../../shared/theme-support/theme.service';
|
||||
import { getMockThemeService } from '../../../../../shared/mocks/theme-service.mock';
|
||||
|
||||
let journalListElementComponent: JournalSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<JournalSearchResultListElementComponent>;
|
||||
@@ -72,7 +74,8 @@ describe('JournalSearchResultListElementComponent', () => {
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||
{ provide: APP_CONFIG, useValue: environmentUseThumbs }
|
||||
{ provide: APP_CONFIG, useValue: environmentUseThumbs },
|
||||
{ provide: ThemeService, useValue: getMockThemeService() }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(JournalSearchResultListElementComponent, {
|
||||
@@ -134,7 +137,8 @@ describe('JournalSearchResultListElementComponent', () => {
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||
{ provide: APP_CONFIG, useValue: enviromentNoThumbs }
|
||||
{ provide: APP_CONFIG, useValue: enviromentNoThumbs },
|
||||
{ provide: ThemeService, useValue: getMockThemeService() }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(JournalSearchResultListElementComponent, {
|
||||
|
@@ -12,6 +12,8 @@ import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service
|
||||
import { APP_CONFIG } from '../../../../../../config/app-config.interface';
|
||||
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
||||
import { TranslateLoaderMock } from '../../../../../shared/mocks/translate-loader.mock';
|
||||
import { ThemeService } from '../../../../../shared/theme-support/theme.service';
|
||||
import { getMockThemeService } from '../../../../../shared/mocks/theme-service.mock';
|
||||
|
||||
let orgUnitListElementComponent: OrgUnitSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<OrgUnitSearchResultListElementComponent>;
|
||||
@@ -77,7 +79,8 @@ describe('OrgUnitSearchResultListElementComponent', () => {
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||
{ provide: APP_CONFIG, useValue: environmentUseThumbs }
|
||||
{ provide: APP_CONFIG, useValue: environmentUseThumbs },
|
||||
{ provide: ThemeService, useValue: getMockThemeService() }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(OrgUnitSearchResultListElementComponent, {
|
||||
@@ -144,7 +147,8 @@ describe('OrgUnitSearchResultListElementComponent', () => {
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||
{ provide: APP_CONFIG, useValue: enviromentNoThumbs }
|
||||
{ provide: APP_CONFIG, useValue: enviromentNoThumbs },
|
||||
{ provide: ThemeService, useValue: getMockThemeService() }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(OrgUnitSearchResultListElementComponent, {
|
||||
|
@@ -12,6 +12,8 @@ import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service
|
||||
import { APP_CONFIG } from '../../../../../../config/app-config.interface';
|
||||
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
||||
import { TranslateLoaderMock } from '../../../../../shared/mocks/translate-loader.mock';
|
||||
import { ThemeService } from '../../../../../shared/theme-support/theme.service';
|
||||
import { getMockThemeService } from '../../../../../shared/mocks/theme-service.mock';
|
||||
|
||||
let personListElementComponent: PersonSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<PersonSearchResultListElementComponent>;
|
||||
@@ -77,7 +79,8 @@ describe('PersonSearchResultListElementComponent', () => {
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||
{ provide: APP_CONFIG, useValue: environmentUseThumbs }
|
||||
{ provide: APP_CONFIG, useValue: environmentUseThumbs },
|
||||
{ provide: ThemeService, useValue: getMockThemeService() }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(PersonSearchResultListElementComponent, {
|
||||
@@ -144,7 +147,8 @@ describe('PersonSearchResultListElementComponent', () => {
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||
{ provide: APP_CONFIG, useValue: enviromentNoThumbs }
|
||||
{ provide: APP_CONFIG, useValue: enviromentNoThumbs },
|
||||
{ provide: ThemeService, useValue: getMockThemeService() }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(PersonSearchResultListElementComponent, {
|
||||
|
@@ -10,6 +10,8 @@ import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service
|
||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { APP_CONFIG } from '../../../../../../config/app-config.interface';
|
||||
import { ThemeService } from '../../../../../shared/theme-support/theme.service';
|
||||
import { getMockThemeService } from '../../../../../shared/mocks/theme-service.mock';
|
||||
|
||||
let projectListElementComponent: ProjectSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<ProjectSearchResultListElementComponent>;
|
||||
@@ -71,7 +73,8 @@ describe('ProjectSearchResultListElementComponent', () => {
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||
{ provide: APP_CONFIG, useValue: environmentUseThumbs }
|
||||
{ provide: APP_CONFIG, useValue: environmentUseThumbs },
|
||||
{ provide: ThemeService, useValue: getMockThemeService() }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(ProjectSearchResultListElementComponent, {
|
||||
@@ -133,7 +136,8 @@ describe('ProjectSearchResultListElementComponent', () => {
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||
{ provide: APP_CONFIG, useValue: enviromentNoThumbs }
|
||||
{ provide: APP_CONFIG, useValue: enviromentNoThumbs },
|
||||
{ provide: ThemeService, useValue: getMockThemeService() }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(ProjectSearchResultListElementComponent, {
|
||||
|
@@ -3,6 +3,8 @@ import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { ImportExternalPageComponent } from './import-external-page.component';
|
||||
import { ThemeService } from '../shared/theme-support/theme.service';
|
||||
import { getMockThemeService } from '../shared/mocks/theme-service.mock';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ActivatedRouteStub } from '../shared/testing/active-router.stub';
|
||||
|
||||
describe('ImportExternalPageComponent', () => {
|
||||
let component: ImportExternalPageComponent;
|
||||
@@ -13,6 +15,7 @@ describe('ImportExternalPageComponent', () => {
|
||||
imports: [ImportExternalPageComponent],
|
||||
providers: [
|
||||
{ provide: ThemeService, useValue: getMockThemeService() },
|
||||
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
})
|
||||
|
@@ -23,12 +23,12 @@ import { UUIDService } from '../../../../core/shared/uuid.service';
|
||||
import { isNotEmpty } from '../../../../shared/empty.util';
|
||||
import { TranslateLoaderMock } from '../../../../shared/mocks/translate-loader.mock';
|
||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||
import {
|
||||
createSuccessfulRemoteDataObject$
|
||||
} from '../../../../shared/remote-data.utils';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../../../shared/remote-data.utils';
|
||||
import { TruncatableService } from '../../../../shared/truncatable/truncatable.service';
|
||||
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
|
||||
import { GenericItemPageFieldComponent } from '../../field-components/specific-field/generic/generic-item-page-field.component';
|
||||
import {
|
||||
GenericItemPageFieldComponent
|
||||
} from '../../field-components/specific-field/generic/generic-item-page-field.component';
|
||||
import { compareArraysUsing, compareArraysUsingIds } from './item-relationships-utils';
|
||||
import { createPaginatedList } from '../../../../shared/testing/utils.test';
|
||||
import { RouteService } from '../../../../core/services/route.service';
|
||||
@@ -41,14 +41,16 @@ import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { AuthorizationDataService } from '../../../../core/data/feature-authorization/authorization-data.service';
|
||||
import { ResearcherProfileDataService } from '../../../../core/profile/researcher-profile-data.service';
|
||||
import { BrowseDefinitionDataService } from '../../../../core/browse/browse-definition-data.service';
|
||||
import {
|
||||
BrowseDefinitionDataServiceStub
|
||||
} from '../../../../shared/testing/browse-definition-data-service.stub';
|
||||
import { BrowseDefinitionDataServiceStub } from '../../../../shared/testing/browse-definition-data-service.stub';
|
||||
|
||||
import { buildPaginatedList } from '../../../../core/data/paginated-list.model';
|
||||
import { PageInfo } from '../../../../core/shared/page-info.model';
|
||||
import { Router } from '@angular/router';
|
||||
import { ItemComponent } from './item.component';
|
||||
import { APP_CONFIG } from '../../../../../config/app-config.interface';
|
||||
import { provideMockStore } from '@ngrx/store/testing';
|
||||
import { routeServiceStub } from '../../../../shared/testing/route-service.stub';
|
||||
|
||||
|
||||
export function getIIIFSearchEnabled(enabled: boolean): MetadataValue {
|
||||
return Object.assign(new MetadataValue(), {
|
||||
@@ -73,6 +75,12 @@ export function getIIIFEnabled(enabled: boolean): MetadataValue {
|
||||
export const mockRouteService = {
|
||||
getPreviousUrl(): Observable<string> {
|
||||
return observableOf('');
|
||||
},
|
||||
getQueryParameterValue(): Observable<string> {
|
||||
return observableOf('');
|
||||
},
|
||||
getRouteParameterValue(): Observable<string> {
|
||||
return observableOf('');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -87,6 +95,7 @@ export function getItemPageFieldsTest(mockItem: Item, component) {
|
||||
return () => {
|
||||
let comp: any;
|
||||
let fixture: ComponentFixture<any>;
|
||||
let relationshipService: jasmine.SpyObj<RelationshipDataService>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
const mockBitstreamDataService = {
|
||||
@@ -99,6 +108,10 @@ export function getItemPageFieldsTest(mockItem: Item, component) {
|
||||
isAuthorized: observableOf(true)
|
||||
});
|
||||
|
||||
relationshipService = jasmine.createSpyObj('relationshipService', {
|
||||
getRelatedItemsByLabel: createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo(), [])),
|
||||
});
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot({
|
||||
@@ -111,12 +124,19 @@ export function getItemPageFieldsTest(mockItem: Item, component) {
|
||||
component, GenericItemPageFieldComponent, TruncatePipe
|
||||
],
|
||||
providers: [
|
||||
{
|
||||
provide: APP_CONFIG,
|
||||
useValue: {
|
||||
browseBy: { showThumbnails: true },
|
||||
markdown: { enabled: true }
|
||||
}
|
||||
},
|
||||
provideMockStore(),
|
||||
{ provide: ItemDataService, useValue: {} },
|
||||
{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: RelationshipDataService, useValue: {} },
|
||||
{ provide: RelationshipDataService, useValue: relationshipService },
|
||||
{ provide: ObjectCacheService, useValue: {} },
|
||||
{ provide: UUIDService, useValue: {} },
|
||||
{ provide: Store, useValue: {} },
|
||||
{ provide: RemoteDataBuildService, useValue: {} },
|
||||
{ provide: CommunityDataService, useValue: {} },
|
||||
{ provide: HALEndpointService, useValue: {} },
|
||||
@@ -129,7 +149,7 @@ export function getItemPageFieldsTest(mockItem: Item, component) {
|
||||
{ provide: BitstreamDataService, useValue: mockBitstreamDataService },
|
||||
{ provide: WorkspaceitemDataService, useValue: {} },
|
||||
{ provide: SearchService, useValue: {} },
|
||||
{ provide: RouteService, useValue: mockRouteService },
|
||||
{ provide: RouteService, useValue: routeServiceStub },
|
||||
{ provide: AuthorizationDataService, useValue: authorizationService },
|
||||
{ provide: ResearcherProfileDataService, useValue: {} },
|
||||
{ provide: BrowseDefinitionDataService, useValue: BrowseDefinitionDataServiceStub },
|
||||
|
@@ -18,6 +18,13 @@ import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
||||
import { TranslateLoaderMock } from '../../../../testing/translate-loader.mock';
|
||||
import { SubmissionService } from '../../../../../submission/submission.service';
|
||||
import { SubmissionServiceStub } from '../../../../testing/submission-service.stub';
|
||||
import { getMockThemeService } from '../../../../mocks/theme-service.mock';
|
||||
import { ThemeService } from '../../../../theme-support/theme.service';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ActivatedRouteStub } from '../../../../testing/active-router.stub';
|
||||
import {
|
||||
ItemSearchResultListElementComponent
|
||||
} from '../../../../object-list/search-result-list-element/item-search-result/item-types/item/item-search-result-list-element.component';
|
||||
|
||||
describe('ExistingMetadataListElementComponent', () => {
|
||||
let component: ExistingMetadataListElementComponent;
|
||||
@@ -85,8 +92,13 @@ describe('ExistingMetadataListElementComponent', () => {
|
||||
{ provide: SelectableListService, useValue: selectionService },
|
||||
{ provide: Store, useValue: store },
|
||||
{ provide: SubmissionService, useValue: submissionServiceStub },
|
||||
{ provide: ThemeService, useValue: getMockThemeService() },
|
||||
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
})
|
||||
.overrideComponent(ExistingMetadataListElementComponent, {
|
||||
remove: { imports: [ItemSearchResultListElementComponent]}
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
@@ -1,7 +1,6 @@
|
||||
import { ChangeDetectorRef, Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { ComponentFixture, inject, TestBed, waitForAsync, } from '@angular/core/testing';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import {
|
||||
DynamicFormArrayModel,
|
||||
@@ -138,7 +137,6 @@ describe('FormComponent test suite', () => {
|
||||
/* TODO make sure these files use mocks instead of real services/components https://github.com/DSpace/dspace-angular/issues/281 */
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
BrowserModule,
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
@@ -439,7 +437,7 @@ describe('FormComponent test suite', () => {
|
||||
selector: 'ds-test-cmp',
|
||||
template: ``,
|
||||
standalone: true,
|
||||
imports: [BrowserModule,
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
|
@@ -13,6 +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';
|
||||
|
||||
const testType = 'TestType';
|
||||
const testContext = Context.Search;
|
||||
@@ -35,16 +36,21 @@ describe('ListableObjectComponentLoaderComponent', () => {
|
||||
getThemeName: 'dspace',
|
||||
});
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), ListableObjectComponentLoaderComponent, ItemListElementComponent, ListableObjectDirective],
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ListableObjectComponentLoaderComponent,
|
||||
ItemListElementComponent,
|
||||
ListableObjectDirective
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
providers: [
|
||||
provideMockStore({}),
|
||||
{ provide: ThemeService, useValue: themeService },
|
||||
{ provide: APP_CONFIG, useValue: { browseBy: { showThumbnails: true } } }
|
||||
]
|
||||
}).overrideComponent(ListableObjectComponentLoaderComponent, {
|
||||
set: {
|
||||
add: {
|
||||
changeDetection: ChangeDetectionStrategy.Default,
|
||||
entryComponents: [ItemListElementComponent]
|
||||
}
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
@@ -5,6 +5,8 @@ import { By } from '@angular/platform-browser';
|
||||
import { Collection } from '../../../core/shared/collection.model';
|
||||
import { LinkService } from '../../../core/cache/builders/link.service';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ActivatedRouteStub } from '../../testing/active-router.stub';
|
||||
|
||||
let collectionGridElementComponent: CollectionGridElementComponent;
|
||||
let fixture: ComponentFixture<CollectionGridElementComponent>;
|
||||
@@ -44,7 +46,8 @@ describe('CollectionGridElementComponent', () => {
|
||||
],
|
||||
providers: [
|
||||
{ provide: 'objectElementProvider', useValue: (mockCollectionWithAbstract) },
|
||||
{ provide: LinkService, useValue: linkService }
|
||||
{ provide: LinkService, useValue: linkService },
|
||||
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(CollectionGridElementComponent, {
|
||||
|
@@ -5,6 +5,8 @@ import { By } from '@angular/platform-browser';
|
||||
import { Community } from '../../../core/shared/community.model';
|
||||
import { LinkService } from '../../../core/cache/builders/link.service';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ActivatedRouteStub } from '../../testing/active-router.stub';
|
||||
|
||||
let communityGridElementComponent: CommunityGridElementComponent;
|
||||
let fixture: ComponentFixture<CommunityGridElementComponent>;
|
||||
@@ -44,7 +46,8 @@ describe('CommunityGridElementComponent', () => {
|
||||
],
|
||||
providers: [
|
||||
{ provide: 'objectElementProvider', useValue: (mockCommunityWithAbstract) },
|
||||
{ provide: LinkService, useValue: linkService }
|
||||
{ provide: LinkService, useValue: linkService },
|
||||
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(CommunityGridElementComponent, {
|
||||
|
@@ -70,6 +70,7 @@ describe('CollectionSearchResultGridElementComponent', () => {
|
||||
CollectionSearchResultGridElementComponent, TruncatePipe
|
||||
],
|
||||
providers: [
|
||||
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() },
|
||||
{ provide: TruncatableService, useValue: truncatableServiceStub },
|
||||
{ provide: 'objectElementProvider', useValue: (mockCollectionWithAbstract) },
|
||||
{ provide: ObjectCacheService, useValue: {} },
|
||||
|
@@ -21,6 +21,8 @@ import { CommunitySearchResultGridElementComponent } from './community-search-re
|
||||
import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service';
|
||||
import { LinkService } from '../../../../core/cache/builders/link.service';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ActivatedRouteStub } from '../../../testing/active-router.stub';
|
||||
|
||||
let communitySearchResultGridElementComponent: CommunitySearchResultGridElementComponent;
|
||||
let fixture: ComponentFixture<CommunitySearchResultGridElementComponent>;
|
||||
@@ -80,7 +82,8 @@ describe('CommunitySearchResultGridElementComponent', () => {
|
||||
{ provide: DSOChangeAnalyzer, useValue: {} },
|
||||
{ provide: DefaultChangeAnalyzer, useValue: {} },
|
||||
{ provide: BitstreamFormatDataService, useValue: {} },
|
||||
{ provide: LinkService, useValue: linkService }
|
||||
{ provide: LinkService, useValue: linkService },
|
||||
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(CommunitySearchResultGridElementComponent, {
|
||||
|
@@ -5,6 +5,8 @@ import { By } from '@angular/platform-browser';
|
||||
import { Collection } from '../../../core/shared/collection.model';
|
||||
import { DSONameService } from '../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../mocks/dso-name.service.mock';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ActivatedRouteStub } from '../../testing/active-router.stub';
|
||||
|
||||
let collectionListElementComponent: CollectionListElementComponent;
|
||||
let fixture: ComponentFixture<CollectionListElementComponent>;
|
||||
@@ -60,7 +62,8 @@ describe('CollectionListElementComponent', () => {
|
||||
imports: [CollectionListElementComponent],
|
||||
providers: [
|
||||
{ provide: DSONameService, useValue: new DSONameServiceMock() },
|
||||
{ provide: 'objectElementProvider', useValue: (mockCollectionWithAbstract) }
|
||||
{ provide: 'objectElementProvider', useValue: (mockCollectionWithAbstract) },
|
||||
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(CollectionListElementComponent, {
|
||||
|
@@ -5,6 +5,8 @@ import { By } from '@angular/platform-browser';
|
||||
import { Community } from '../../../core/shared/community.model';
|
||||
import { DSONameService } from '../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../mocks/dso-name.service.mock';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ActivatedRouteStub } from '../../testing/active-router.stub';
|
||||
|
||||
let communityListElementComponent: CommunityListElementComponent;
|
||||
let fixture: ComponentFixture<CommunityListElementComponent>;
|
||||
@@ -37,7 +39,8 @@ describe('CommunityListElementComponent', () => {
|
||||
imports: [CommunityListElementComponent],
|
||||
providers: [
|
||||
{ provide: DSONameService, useValue: new DSONameServiceMock() },
|
||||
{ provide: 'objectElementProvider', useValue: (mockCommunityWithAbstract) }
|
||||
{ provide: 'objectElementProvider', useValue: (mockCommunityWithAbstract) },
|
||||
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(CommunityListElementComponent, {
|
||||
|
@@ -4,6 +4,8 @@ import { PlainTextMetadataListElementComponent } from './plain-text-metadata-lis
|
||||
import { MetadatumRepresentation } from '../../../../core/shared/metadata-representation/metadatum/metadatum-representation.model';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { mockData } from '../../../testing/browse-definition-data-service.stub';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ActivatedRouteStub } from '../../../testing/active-router.stub';
|
||||
|
||||
// Render the mock representation with the default mock author browse definition so it is also rendered as a link
|
||||
// without affecting other tests
|
||||
@@ -19,6 +21,7 @@ describe('PlainTextMetadataListElementComponent', () => {
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [PlainTextMetadataListElementComponent],
|
||||
providers: [{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() }],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(PlainTextMetadataListElementComponent, {
|
||||
set: { changeDetection: ChangeDetectionStrategy.Default }
|
||||
|
@@ -14,6 +14,8 @@ import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
|
||||
import { APP_CONFIG } from '../../../../../config/app-config.interface';
|
||||
import { environment } from '../../../../../environments/environment';
|
||||
import { Context } from '../../../../core/shared/context.model';
|
||||
import { ThemeService } from '../../../theme-support/theme.service';
|
||||
import { getMockThemeService } from '../../../mocks/theme-service.mock';
|
||||
|
||||
let component: ItemSearchResultListElementSubmissionComponent;
|
||||
let fixture: ComponentFixture<ItemSearchResultListElementSubmissionComponent>;
|
||||
@@ -58,7 +60,8 @@ describe('ItemMyDSpaceResultListElementComponent', () => {
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||
{ provide: APP_CONFIG, useValue: environment }
|
||||
{ provide: APP_CONFIG, useValue: environment },
|
||||
{ provide: ThemeService, useValue: getMockThemeService() }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(ItemSearchResultListElementSubmissionComponent, {
|
||||
|
@@ -27,6 +27,8 @@ import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
|
||||
import { APP_CONFIG } from '../../../../../config/app-config.interface';
|
||||
import { ObjectCacheService } from '../../../../core/cache/object-cache.service';
|
||||
import { Context } from '../../../../core/shared/context.model';
|
||||
import { ThemeService } from '../../../theme-support/theme.service';
|
||||
import { getMockThemeService } from '../../../mocks/theme-service.mock';
|
||||
|
||||
let component: PoolSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<PoolSearchResultListElementComponent>;
|
||||
@@ -88,7 +90,8 @@ describe('PoolSearchResultListElementComponent', () => {
|
||||
{ provide: LinkService, useValue: linkService },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||
{ provide: APP_CONFIG, useValue: environmentUseThumbs },
|
||||
{ provide: ObjectCacheService, useValue: objectCacheServiceMock }
|
||||
{ provide: ObjectCacheService, useValue: objectCacheServiceMock },
|
||||
{ provide: ThemeService, useValue: getMockThemeService() }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(PoolSearchResultListElementComponent, {
|
||||
|
@@ -19,6 +19,8 @@ import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
|
||||
import { APP_CONFIG } from '../../../../../config/app-config.interface';
|
||||
import { Context } from '../../../../core/shared/context.model';
|
||||
import { ThemeService } from '../../../theme-support/theme.service';
|
||||
import { getMockThemeService } from '../../../mocks/theme-service.mock';
|
||||
|
||||
let component: WorkspaceItemSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<WorkspaceItemSearchResultListElementComponent>;
|
||||
@@ -76,7 +78,8 @@ describe('WorkspaceItemSearchResultListElementComponent', () => {
|
||||
{ provide: ItemDataService, useValue: {} },
|
||||
{ provide: LinkService, useValue: linkService },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||
{ provide: APP_CONFIG, useValue: environmentUseThumbs }
|
||||
{ provide: APP_CONFIG, useValue: environmentUseThumbs },
|
||||
{ provide: ThemeService, useValue: getMockThemeService() }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(WorkspaceItemSearchResultListElementComponent, {
|
||||
|
@@ -10,6 +10,8 @@ import { CollectionSearchResult } from '../../../object-collection/shared/collec
|
||||
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
|
||||
import { APP_CONFIG } from '../../../../../config/app-config.interface';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ActivatedRouteStub } from '../../../testing/active-router.stub';
|
||||
|
||||
let collectionSearchResultListElementComponent: CollectionSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<CollectionSearchResultListElementComponent>;
|
||||
@@ -57,7 +59,8 @@ describe('CollectionSearchResultListElementComponent', () => {
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: truncatableServiceStub },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||
{ provide: APP_CONFIG, useValue: environmentUseThumbs }
|
||||
{ provide: APP_CONFIG, useValue: environmentUseThumbs },
|
||||
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(CollectionSearchResultListElementComponent, {
|
||||
|
@@ -10,6 +10,8 @@ import { CommunitySearchResult } from '../../../object-collection/shared/communi
|
||||
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
|
||||
import { APP_CONFIG } from '../../../../../config/app-config.interface';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ActivatedRouteStub } from '../../../testing/active-router.stub';
|
||||
|
||||
let communitySearchResultListElementComponent: CommunitySearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<CommunitySearchResultListElementComponent>;
|
||||
@@ -57,7 +59,8 @@ describe('CommunitySearchResultListElementComponent', () => {
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: truncatableServiceStub },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||
{ provide: APP_CONFIG, useValue: environmentUseThumbs }
|
||||
{ provide: APP_CONFIG, useValue: environmentUseThumbs },
|
||||
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(CommunitySearchResultListElementComponent, {
|
||||
|
@@ -383,6 +383,7 @@ describe('Pagination component', () => {
|
||||
standalone: true,
|
||||
imports: [CommonModule,
|
||||
NgxPaginationModule,
|
||||
PaginationComponent,
|
||||
NgbModule]
|
||||
})
|
||||
class TestComponent {
|
||||
|
@@ -1,5 +1,4 @@
|
||||
import { ChangeDetectorRef, Component, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
@@ -138,7 +137,6 @@ describe('SubmissionSectionIdentifiersComponent test suite', () => {
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
BrowserModule,
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
@@ -251,7 +249,7 @@ describe('SubmissionSectionIdentifiersComponent test suite', () => {
|
||||
selector: 'ds-test-cmp',
|
||||
template: ``,
|
||||
standalone: true,
|
||||
imports: [BrowserModule,
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
|
@@ -1,5 +1,4 @@
|
||||
import { ChangeDetectorRef, Component, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
@@ -114,7 +113,6 @@ describe('SubmissionSectionLicenseComponent test suite', () => {
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
BrowserModule,
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
@@ -325,7 +323,7 @@ describe('SubmissionSectionLicenseComponent test suite', () => {
|
||||
selector: 'ds-test-cmp',
|
||||
template: ``,
|
||||
standalone: true,
|
||||
imports: [BrowserModule,
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
ReactiveFormsModule]
|
||||
|
@@ -1,6 +1,5 @@
|
||||
import { ChangeDetectorRef, Component, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { ComponentFixture, fakeAsync, inject, TestBed, tick, waitForAsync } from '@angular/core/testing';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import {
|
||||
@@ -47,6 +46,7 @@ import {
|
||||
} from '../../../../../core/json-patch/builder/json-patch-operation-path-combiner';
|
||||
import { dateToISOFormat } from '../../../../../shared/date.util';
|
||||
import { of } from 'rxjs';
|
||||
import { provideMockStore } from '@ngrx/store/testing';
|
||||
|
||||
const jsonPatchOpBuilder: any = jasmine.createSpyObj('jsonPatchOpBuilder', {
|
||||
add: jasmine.createSpy('add'),
|
||||
@@ -83,7 +83,6 @@ describe('SubmissionSectionUploadFileEditComponent test suite', () => {
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
BrowserModule,
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
@@ -98,6 +97,7 @@ describe('SubmissionSectionUploadFileEditComponent test suite', () => {
|
||||
{ provide: SubmissionJsonPatchOperationsService, useValue: submissionJsonPatchOperationsServiceStub },
|
||||
{ provide: JsonPatchOperationsBuilder, useValue: jsonPatchOpBuilder },
|
||||
{ provide: SectionUploadService, useValue: getMockSectionUploadService() },
|
||||
provideMockStore(),
|
||||
FormBuilderService,
|
||||
ChangeDetectorRef,
|
||||
SubmissionSectionUploadFileEditComponent,
|
||||
@@ -135,11 +135,10 @@ describe('SubmissionSectionUploadFileEditComponent test suite', () => {
|
||||
testFixture.destroy();
|
||||
});
|
||||
|
||||
it('should create SubmissionSectionUploadFileEditComponent', inject([SubmissionSectionUploadFileEditComponent], (app: SubmissionSectionUploadFileEditComponent) => {
|
||||
|
||||
it('should create SubmissionSectionUploadFileEditComponent', () => {
|
||||
let app = TestBed.inject(SubmissionSectionUploadFileEditComponent);
|
||||
expect(app).toBeDefined();
|
||||
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
||||
describe('', () => {
|
||||
@@ -317,10 +316,11 @@ describe('SubmissionSectionUploadFileEditComponent test suite', () => {
|
||||
selector: 'ds-test-cmp',
|
||||
template: ``,
|
||||
standalone: true,
|
||||
imports: [BrowserModule,
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
ReactiveFormsModule]
|
||||
ReactiveFormsModule
|
||||
]
|
||||
})
|
||||
class TestComponent {
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { ChangeDetectorRef, Component, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
import { BrowserModule, By } from '@angular/platform-browser';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
import { of, of as observableOf } from 'rxjs';
|
||||
@@ -77,7 +77,6 @@ describe('SubmissionSectionUploadFileComponent test suite', () => {
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
BrowserModule,
|
||||
CommonModule,
|
||||
NgbModule,
|
||||
TranslateModule.forRoot(),
|
||||
@@ -237,7 +236,7 @@ describe('SubmissionSectionUploadFileComponent test suite', () => {
|
||||
selector: 'ds-test-cmp',
|
||||
template: ``,
|
||||
standalone: true,
|
||||
imports: [BrowserModule,
|
||||
imports: [
|
||||
CommonModule,
|
||||
NgbModule]
|
||||
})
|
||||
|
@@ -1,6 +1,5 @@
|
||||
import { ChangeDetectorRef, Component, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
@@ -164,7 +163,6 @@ describe('SubmissionSectionUploadComponent test suite', () => {
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
BrowserModule,
|
||||
CommonModule,
|
||||
TranslateModule.forRoot(),
|
||||
SubmissionSectionUploadComponent,
|
||||
@@ -366,7 +364,7 @@ describe('SubmissionSectionUploadComponent test suite', () => {
|
||||
selector: 'ds-test-cmp',
|
||||
template: ``,
|
||||
standalone: true,
|
||||
imports: [BrowserModule,
|
||||
imports: [
|
||||
CommonModule]
|
||||
})
|
||||
class TestComponent {
|
||||
|
Reference in New Issue
Block a user