mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Fixed AOT build after upgrade to angular 7
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { MetadataRegistryComponent } from './metadata-registry.component';
|
||||
import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { RemoteData } from '../../../core/data/remote-data';
|
||||
import { PaginatedList } from '../../../core/data/paginated-list';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { By } from '@angular/platform-browser';
|
||||
@@ -18,6 +17,7 @@ import { NotificationsService } from '../../../shared/notifications/notification
|
||||
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service-stub';
|
||||
import { RestResponse } from '../../../core/cache/response.models';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../../shared/testing/utils';
|
||||
import { MetadataSchema } from '../../../core/metadata/metadata-schema.model';
|
||||
|
||||
describe('MetadataRegistryComponent', () => {
|
||||
let comp: MetadataRegistryComponent;
|
||||
@@ -101,12 +101,12 @@ describe('MetadataRegistryComponent', () => {
|
||||
|
||||
it('should start editing the selected schema', async(() => {
|
||||
fixture.whenStable().then(() => {
|
||||
expect(registryService.editMetadataSchema).toHaveBeenCalledWith(mockSchemasList[0]);
|
||||
expect(registryService.editMetadataSchema).toHaveBeenCalledWith(mockSchemasList[0] as MetadataSchema);
|
||||
});
|
||||
}));
|
||||
|
||||
it('should cancel editing the selected schema when clicked again', async(() => {
|
||||
spyOn(registryService, 'getActiveMetadataSchema').and.returnValue(observableOf(mockSchemasList[0]));
|
||||
spyOn(registryService, 'getActiveMetadataSchema').and.returnValue(observableOf(mockSchemasList[0] as MetadataSchema));
|
||||
spyOn(registryService, 'cancelEditMetadataSchema');
|
||||
row.click();
|
||||
fixture.detectChanges();
|
||||
@@ -121,7 +121,7 @@ describe('MetadataRegistryComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
spyOn(registryService, 'deleteMetadataSchema').and.callThrough();
|
||||
spyOn(registryService, 'getSelectedMetadataSchemas').and.returnValue(observableOf(selectedSchemas));
|
||||
spyOn(registryService, 'getSelectedMetadataSchemas').and.returnValue(observableOf(selectedSchemas as MetadataSchema[]));
|
||||
comp.deleteSchemas();
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
@@ -1,7 +1,6 @@
|
||||
import { MetadataSchemaComponent } from './metadata-schema.component';
|
||||
import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { RemoteData } from '../../../core/data/remote-data';
|
||||
import { PaginatedList } from '../../../core/data/paginated-list';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
@@ -22,6 +21,7 @@ import { NotificationsServiceStub } from '../../../shared/testing/notifications-
|
||||
import { RestResponse } from '../../../core/cache/response.models';
|
||||
import { MetadataSchema } from '../../../core/metadata/metadata-schema.model';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../../shared/testing/utils';
|
||||
import { MetadataField } from '../../../core/metadata/metadata-field.model';
|
||||
|
||||
describe('MetadataSchemaComponent', () => {
|
||||
let comp: MetadataSchemaComponent;
|
||||
@@ -152,12 +152,12 @@ describe('MetadataSchemaComponent', () => {
|
||||
|
||||
it('should start editing the selected field', async(() => {
|
||||
fixture.whenStable().then(() => {
|
||||
expect(registryService.editMetadataField).toHaveBeenCalledWith(mockFieldsList[2]);
|
||||
expect(registryService.editMetadataField).toHaveBeenCalledWith(mockFieldsList[2] as MetadataField);
|
||||
});
|
||||
}));
|
||||
|
||||
it('should cancel editing the selected field when clicked again', async(() => {
|
||||
spyOn(registryService, 'getActiveMetadataField').and.returnValue(observableOf(mockFieldsList[2]));
|
||||
spyOn(registryService, 'getActiveMetadataField').and.returnValue(observableOf(mockFieldsList[2] as MetadataField));
|
||||
spyOn(registryService, 'cancelEditMetadataField');
|
||||
row.click();
|
||||
fixture.detectChanges();
|
||||
@@ -172,7 +172,7 @@ describe('MetadataSchemaComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
spyOn(registryService, 'deleteMetadataField').and.callThrough();
|
||||
spyOn(registryService, 'getSelectedMetadataFields').and.returnValue(observableOf(selectedFields));
|
||||
spyOn(registryService, 'getSelectedMetadataFields').and.returnValue(observableOf(selectedFields as MetadataField[]));
|
||||
comp.deleteFields();
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
@@ -3,7 +3,7 @@ import { RequestEntry } from './request.reducer';
|
||||
import { RestResponse } from '../cache/response.models';
|
||||
import { Observable, of as observableOf } from 'rxjs';
|
||||
import { Action, Store } from '@ngrx/store';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { AppState } from '../../app.reducer';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { cold, getTestScheduler, hot } from 'jasmine-marbles';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
@@ -36,7 +36,7 @@ describe('BitstreamFormatDataService', () => {
|
||||
dispatch(action: Action) {
|
||||
// Do Nothing
|
||||
}
|
||||
} as Store<CoreState>;
|
||||
} as Store<AppState>;
|
||||
|
||||
const objectCache = {} as ObjectCacheService;
|
||||
const halEndpointService = {
|
||||
|
@@ -6,22 +6,14 @@ import { CoreState } from '../core.reducers';
|
||||
import { ItemDataService } from './item-data.service';
|
||||
import { RequestService } from './request.service';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import {
|
||||
DeleteRequest,
|
||||
FindListOptions,
|
||||
GetRequest,
|
||||
MappedCollectionsRequest,
|
||||
PostRequest,
|
||||
RestRequest
|
||||
} from './request.models';
|
||||
import { DeleteRequest, FindListOptions, PostRequest, RestRequest } from './request.models';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Observable, of as observableOf } from 'rxjs';
|
||||
import { RestResponse } from '../cache/response.models';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { RequestEntry } from './request.reducer';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { getMockRequestService } from '../../shared/mocks/mock-request.service';
|
||||
|
||||
describe('ItemDataService', () => {
|
||||
@@ -184,7 +176,7 @@ describe('ItemDataService', () => {
|
||||
});
|
||||
|
||||
it('should configure a DELETE request', () => {
|
||||
result.subscribe(() => expect(requestService.configure).toHaveBeenCalledWith(jasmine.any(DeleteRequest), undefined));
|
||||
result.subscribe(() => expect(requestService.configure).toHaveBeenCalledWith(jasmine.any(DeleteRequest)));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -198,7 +190,7 @@ describe('ItemDataService', () => {
|
||||
});
|
||||
|
||||
it('should configure a POST request', () => {
|
||||
result.subscribe(() => expect(requestService.configure).toHaveBeenCalledWith(jasmine.any(PostRequest), undefined));
|
||||
result.subscribe(() => expect(requestService.configure).toHaveBeenCalledWith(jasmine.any(PostRequest)));
|
||||
});
|
||||
});
|
||||
|
||||
|
@@ -21,6 +21,7 @@ import {
|
||||
} from './request.models';
|
||||
import { RequestService } from './request.service';
|
||||
import { TestScheduler } from 'rxjs/testing';
|
||||
import { RequestEntry } from './request.reducer';
|
||||
|
||||
describe('RequestService', () => {
|
||||
let scheduler: TestScheduler;
|
||||
@@ -107,7 +108,7 @@ describe('RequestService', () => {
|
||||
beforeEach(() => {
|
||||
spyOn(service, 'getByHref').and.returnValue(observableOf({
|
||||
completed: false
|
||||
}))
|
||||
} as RequestEntry))
|
||||
});
|
||||
|
||||
it('should return true', () => {
|
||||
@@ -122,7 +123,7 @@ describe('RequestService', () => {
|
||||
beforeEach(() => {
|
||||
spyOn(service, 'getByHref').and.returnValues(observableOf({
|
||||
completed: true
|
||||
}));
|
||||
} as RequestEntry));
|
||||
});
|
||||
|
||||
it('should return false', () => {
|
||||
@@ -432,7 +433,7 @@ describe('RequestService', () => {
|
||||
let valid;
|
||||
const requestEntry = { completed: false };
|
||||
beforeEach(() => {
|
||||
spyOn(service, 'getByUUID').and.returnValue(observableOf(requestEntry));
|
||||
spyOn(service, 'getByUUID').and.returnValue(observableOf(requestEntry as RequestEntry));
|
||||
valid = serviceAsAny.isValid(requestEntry);
|
||||
});
|
||||
it('return an observable emitting false', () => {
|
||||
@@ -444,7 +445,7 @@ describe('RequestService', () => {
|
||||
let valid;
|
||||
const requestEntry = { completed: true, response: { isSuccessful: false } };
|
||||
beforeEach(() => {
|
||||
spyOn(service, 'getByUUID').and.returnValue(observableOf(requestEntry));
|
||||
spyOn(service, 'getByUUID').and.returnValue(observableOf(requestEntry as RequestEntry));
|
||||
valid = serviceAsAny.isValid(requestEntry);
|
||||
});
|
||||
it('return an observable emitting false', () => {
|
||||
@@ -470,7 +471,7 @@ describe('RequestService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
spyOn(Date.prototype, 'getTime').and.returnValue(now);
|
||||
spyOn(service, 'getByUUID').and.returnValue(observableOf(requestEntry));
|
||||
spyOn(service, 'getByUUID').and.returnValue(observableOf(requestEntry as RequestEntry));
|
||||
valid = serviceAsAny.isValid(requestEntry);
|
||||
});
|
||||
|
||||
@@ -497,7 +498,7 @@ describe('RequestService', () => {
|
||||
};
|
||||
beforeEach(() => {
|
||||
spyOn(Date.prototype, 'getTime').and.returnValue(now);
|
||||
spyOn(service, 'getByUUID').and.returnValue(observableOf(requestEntry));
|
||||
spyOn(service, 'getByUUID').and.returnValue(observableOf(requestEntry as RequestEntry));
|
||||
valid = serviceAsAny.isValid(requestEntry);
|
||||
});
|
||||
|
||||
|
@@ -3,11 +3,9 @@ import { TranslateModule } from '@ngx-translate/core';
|
||||
import { Location } from '@angular/common';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { DynamicFormService, DynamicInputModel } from '@ng-dynamic-forms/core';
|
||||
import { DynamicFormControlModel, DynamicFormService, DynamicInputModel } from '@ng-dynamic-forms/core';
|
||||
import { FormControl, FormGroup } from '@angular/forms';
|
||||
import { DynamicFormControlModel } from '@ng-dynamic-forms/core/src/model/dynamic-form-control.model';
|
||||
import { Community } from '../../../core/shared/community.model';
|
||||
import { ResourceType } from '../../../core/shared/resource-type';
|
||||
import { ComColFormComponent } from './comcol-form.component';
|
||||
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
||||
import { hasValue } from '../../empty.util';
|
||||
|
@@ -12,6 +12,7 @@ import {
|
||||
ExpandMenuAction, ExpandMenuPreviewAction, HideMenuAction,
|
||||
RemoveMenuSectionAction, ShowMenuAction, ToggleActiveMenuSectionAction, ToggleMenuAction
|
||||
} from './menu.actions';
|
||||
import { MenuSection } from './menu.reducer';
|
||||
|
||||
describe('MenuService', () => {
|
||||
let service: MenuService;
|
||||
@@ -125,7 +126,7 @@ describe('MenuService', () => {
|
||||
describe('when the subsection list is not empty', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
spyOn(service, 'getMenuSection').and.returnValue(observableOf(visibleSection1));
|
||||
spyOn(service, 'getMenuSection').and.returnValue(observableOf(visibleSection1 as MenuSection));
|
||||
selectSpy.and.callFake(() => {
|
||||
return () => {
|
||||
return () => hot('a', {
|
||||
@@ -283,7 +284,7 @@ describe('MenuService', () => {
|
||||
|
||||
describe('isSectionActive', () => {
|
||||
beforeEach(() => {
|
||||
spyOn(service, 'getMenuSection').and.returnValue(observableOf(visibleSection1));
|
||||
spyOn(service, 'getMenuSection').and.returnValue(observableOf(visibleSection1 as MenuSection));
|
||||
});
|
||||
|
||||
it('should return false when the section is not active', () => {
|
||||
@@ -298,7 +299,7 @@ describe('MenuService', () => {
|
||||
|
||||
describe('isSectionVisible', () => {
|
||||
beforeEach(() => {
|
||||
spyOn(service, 'getMenuSection').and.returnValue(observableOf(hiddenSection3));
|
||||
spyOn(service, 'getMenuSection').and.returnValue(observableOf(hiddenSection3 as MenuSection));
|
||||
});
|
||||
|
||||
it('should return false when the section is hidden', () => {
|
||||
|
@@ -88,7 +88,7 @@ describe('ItemDetailPreviewComponent', () => {
|
||||
component.object = { hitHighlights: {} } as any;
|
||||
component.item = mockItem;
|
||||
component.separator = ', ';
|
||||
spyOn(component.item, 'getFiles').and.returnValue(mockItem.bundles);
|
||||
spyOn(component.item, 'getFiles').and.returnValue(mockItem.bundles as any);
|
||||
fixture.detectChanges();
|
||||
|
||||
}));
|
||||
|
@@ -4,7 +4,6 @@ import { By } from '@angular/platform-browser';
|
||||
import { ObjectDetailComponent } from './object-detail.component';
|
||||
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
||||
import { MockTranslateLoader } from '../mocks/mock-translate-loader';
|
||||
import { RemoteData } from '../../core/data/remote-data';
|
||||
import { PaginatedList } from '../../core/data/paginated-list';
|
||||
import { PageInfo } from '../../core/shared/page-info.model';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
@@ -14,7 +13,7 @@ import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
||||
describe('ObjectDetailComponent', () => {
|
||||
let comp: ObjectDetailComponent;
|
||||
let fixture: ComponentFixture<ObjectDetailComponent>;
|
||||
const testEvent = {test: 'test'};
|
||||
const testEvent: any = {test: 'test'};
|
||||
|
||||
const testObjects = [
|
||||
Object.assign (new DSpaceObject(), { one: 1 }),
|
||||
@@ -28,7 +27,7 @@ describe('ObjectDetailComponent', () => {
|
||||
Object.assign (new DSpaceObject(), { nine: 9 }),
|
||||
Object.assign (new DSpaceObject(), { ten: 10 }),
|
||||
];
|
||||
const pageInfo = Object.assign(new PageInfo(), {elementsPerPage: 1, totalElements: 10, totalPages: 10, currentPage: 1})
|
||||
const pageInfo = Object.assign(new PageInfo(), {elementsPerPage: 1, totalElements: 10, totalPages: 10, currentPage: 1});
|
||||
const mockRD = createSuccessfulRemoteDataObject(new PaginatedList(pageInfo, testObjects));
|
||||
|
||||
beforeEach(async(() => {
|
||||
|
@@ -6,7 +6,7 @@ import { By } from '@angular/platform-browser';
|
||||
describe('ObjectListComponent', () => {
|
||||
let comp: ObjectListComponent;
|
||||
let fixture: ComponentFixture<ObjectListComponent>;
|
||||
const testEvent = {test: 'test'};
|
||||
const testEvent: any = {test: 'test'};
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
|
@@ -3,8 +3,8 @@ import { CommonModule } from '@angular/common';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { DebugElement, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { ActivatedRoute, NavigationExtras, Router } from '@angular/router';
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { of as observableOf } from 'rxjs/internal/observable/of';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { StartsWithDateComponent } from './starts-with-date.component';
|
||||
@@ -159,7 +159,7 @@ describe('StartsWithDateComponent', () => {
|
||||
describe('when filling in the input form', () => {
|
||||
let form;
|
||||
const expectedValue = '2015';
|
||||
const extras = {
|
||||
const extras: NavigationExtras = {
|
||||
queryParams: Object.assign({ startsWith: expectedValue }),
|
||||
queryParamsHandling: 'merge'
|
||||
};
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { ActivatedRoute, NavigationExtras, Router } from '@angular/router';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
@@ -66,7 +66,7 @@ describe('StartsWithTextComponent', () => {
|
||||
let select;
|
||||
let input;
|
||||
const expectedValue = '0';
|
||||
const extras = {
|
||||
const extras: NavigationExtras = {
|
||||
queryParams: Object.assign({ startsWith: expectedValue }),
|
||||
queryParamsHandling: 'merge'
|
||||
};
|
||||
@@ -96,7 +96,7 @@ describe('StartsWithTextComponent', () => {
|
||||
let select;
|
||||
let input;
|
||||
const expectedValue = options[1];
|
||||
const extras = {
|
||||
const extras: NavigationExtras = {
|
||||
queryParams: Object.assign({ startsWith: expectedValue }),
|
||||
queryParamsHandling: 'merge'
|
||||
};
|
||||
@@ -126,7 +126,7 @@ describe('StartsWithTextComponent', () => {
|
||||
let optionLink;
|
||||
let input;
|
||||
const expectedValue = options[1];
|
||||
const extras = {
|
||||
const extras: NavigationExtras = {
|
||||
queryParams: Object.assign({ startsWith: expectedValue }),
|
||||
queryParamsHandling: 'merge'
|
||||
};
|
||||
@@ -154,7 +154,7 @@ describe('StartsWithTextComponent', () => {
|
||||
describe('when filling in the input form', () => {
|
||||
let form;
|
||||
const expectedValue = 'A';
|
||||
const extras = {
|
||||
const extras: NavigationExtras = {
|
||||
queryParams: Object.assign({ startsWith: expectedValue }),
|
||||
queryParamsHandling: 'merge'
|
||||
};
|
||||
|
@@ -20,7 +20,7 @@ describe('Angulartics2DSpace', () => {
|
||||
|
||||
it('should use the statisticsService', () => {
|
||||
provider.startTracking();
|
||||
expect(statisticsService.trackViewEvent).toHaveBeenCalledWith('mock-object');
|
||||
expect(statisticsService.trackViewEvent).toHaveBeenCalledWith('mock-object' as any);
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -342,7 +342,7 @@ describe('SubmissionFormCollectionComponent Component', () => {
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(comp.searchField.reset).toHaveBeenCalled();
|
||||
expect(comp.collectionChange.emit).toHaveBeenCalledWith(submissionRestResponse[0]);
|
||||
expect(comp.collectionChange.emit).toHaveBeenCalledWith(submissionRestResponse[0] as any);
|
||||
expect(submissionServiceStub.changeSubmissionCollection).toHaveBeenCalled();
|
||||
expect(comp.selectedCollectionId).toBe(mockCollectionList[1].collection.id);
|
||||
expect(comp.selectedCollectionName$).toBeObservable(cold('(a|)', {
|
||||
|
Reference in New Issue
Block a user