mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-16 14:33:03 +00:00
fixed tests after angular 10 upgrade
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
import { ChangeDetectorRef, Component, CUSTOM_ELEMENTS_SCHEMA, DebugElement } from '@angular/core';
|
||||
import { async, ComponentFixture, fakeAsync, inject, TestBed, tick } from '@angular/core/testing';
|
||||
import { ComponentFixture, fakeAsync, inject, TestBed, tick, waitForAsync } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { cold } from 'jasmine-marbles';
|
||||
import { of } from 'rxjs';
|
||||
|
||||
import { SubmissionServiceStub } from '../../../shared/testing/submission-service.stub';
|
||||
import { mockSubmissionId, mockSubmissionRestResponse } from '../../../shared/mocks/submission.mock';
|
||||
@@ -18,11 +20,9 @@ import { JsonPatchOperationsBuilder } from '../../../core/json-patch/builder/jso
|
||||
import { JsonPatchOperationPathCombiner } from '../../../core/json-patch/builder/json-patch-operation-path-combiner';
|
||||
import { createTestComponent } from '../../../shared/testing/utils.test';
|
||||
import { CollectionDataService } from '../../../core/data/collection-data.service';
|
||||
import { hot, cold } from 'jasmine-marbles';
|
||||
import { of } from 'rxjs';
|
||||
import { SectionsService } from '../../sections/sections.service';
|
||||
import { componentFactoryName } from '@angular/compiler';
|
||||
import { Collection } from 'src/app/core/shared/collection.model';
|
||||
import { Collection } from '../../../core/shared/collection.model';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
||||
|
||||
describe('SubmissionFormCollectionComponent Component', () => {
|
||||
|
||||
@@ -37,6 +37,20 @@ describe('SubmissionFormCollectionComponent Component', () => {
|
||||
const definition = 'traditional';
|
||||
const submissionRestResponse = mockSubmissionRestResponse;
|
||||
|
||||
const mockCollection = Object.assign(new Collection(), {
|
||||
name: 'Community 1-Collection 1',
|
||||
id: collectionId,
|
||||
metadata: [
|
||||
{
|
||||
key: 'dc.title',
|
||||
language: 'en_US',
|
||||
value: 'Community 1-Collection 1'
|
||||
}],
|
||||
_links: {
|
||||
defaultAccessConditions: collectionId + '/defaultAccessConditions'
|
||||
}
|
||||
});
|
||||
|
||||
const mockCollectionList = [
|
||||
{
|
||||
communities: [
|
||||
@@ -109,7 +123,7 @@ describe('SubmissionFormCollectionComponent Component', () => {
|
||||
isSectionAvailable: of(true)
|
||||
});
|
||||
|
||||
beforeEach(async(() => {
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
FormsModule,
|
||||
@@ -142,6 +156,7 @@ describe('SubmissionFormCollectionComponent Component', () => {
|
||||
|
||||
// synchronous beforeEach
|
||||
beforeEach(() => {
|
||||
collectionDataService.findById.and.returnValue(createSuccessfulRemoteDataObject$(mockCollection));
|
||||
const html = `
|
||||
<ds-submission-form-collection [currentCollectionId]="collectionId"
|
||||
[currentDefinition]="definitionId"
|
||||
@@ -275,6 +290,6 @@ class TestComponent {
|
||||
definitionId = 'traditional';
|
||||
submissionId = mockSubmissionId;
|
||||
|
||||
onCollectionChange = () => { return; }
|
||||
onCollectionChange = () => { return; };
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user