mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 18:44:14 +00:00
[DURACOM-191] fix some tests, find broken assertions
This commit is contained in:
@@ -30,8 +30,7 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
|||||||
import { NotificationsBoardComponent } from '../shared/notifications/notifications-board/notifications-board.component';
|
import { NotificationsBoardComponent } from '../shared/notifications/notifications-board/notifications-board.component';
|
||||||
import { SystemWideAlertBannerComponent } from '../system-wide-alert/alert-banner/system-wide-alert-banner.component';
|
import { SystemWideAlertBannerComponent } from '../system-wide-alert/alert-banner/system-wide-alert-banner.component';
|
||||||
|
|
||||||
// TODO: enable this test suite and fix it
|
describe('RootComponent', () => {
|
||||||
xdescribe('RootComponent', () => {
|
|
||||||
let component: RootComponent;
|
let component: RootComponent;
|
||||||
let fixture: ComponentFixture<RootComponent>;
|
let fixture: ComponentFixture<RootComponent>;
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
// Load the implementations that should be tested
|
// Load the implementations that should be tested
|
||||||
import { ChangeDetectorRef, Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
import { ChangeDetectorRef, Component, CUSTOM_ELEMENTS_SCHEMA, forwardRef } from '@angular/core';
|
||||||
import { ComponentFixture, inject, TestBed, waitForAsync, } from '@angular/core/testing';
|
import { ComponentFixture, inject, TestBed, waitForAsync, } from '@angular/core/testing';
|
||||||
import { FormsModule, ReactiveFormsModule, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
import { FormsModule, ReactiveFormsModule, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
@@ -30,6 +30,8 @@ import { SubmissionObjectDataService } from '../../../../../../core/submission/s
|
|||||||
import { SubmissionService } from '../../../../../../submission/submission.service';
|
import { SubmissionService } from '../../../../../../submission/submission.service';
|
||||||
import { APP_CONFIG } from 'src/config/app-config.interface';
|
import { APP_CONFIG } from 'src/config/app-config.interface';
|
||||||
import { environment } from 'src/environments/environment.test';
|
import { environment } from 'src/environments/environment.test';
|
||||||
|
import { ThemedLoadingComponent } from '../../../../../loading/themed-loading.component';
|
||||||
|
import { ChipsComponent } from '../../../../chips/chips.component';
|
||||||
|
|
||||||
export let FORM_GROUP_TEST_MODEL_CONFIG;
|
export let FORM_GROUP_TEST_MODEL_CONFIG;
|
||||||
|
|
||||||
@@ -94,8 +96,7 @@ function init() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: enable this test suite and fix it
|
describe('DsDynamicRelationGroupComponent test suite', () => {
|
||||||
xdescribe('DsDynamicRelationGroupComponent test suite', () => {
|
|
||||||
let testComp: TestComponent;
|
let testComp: TestComponent;
|
||||||
let groupComp: DsDynamicRelationGroupComponent;
|
let groupComp: DsDynamicRelationGroupComponent;
|
||||||
let testFixture: ComponentFixture<TestComponent>;
|
let testFixture: ComponentFixture<TestComponent>;
|
||||||
@@ -142,11 +143,17 @@ xdescribe('DsDynamicRelationGroupComponent test suite', () => {
|
|||||||
],
|
],
|
||||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||||
})
|
})
|
||||||
|
.overrideComponent(DsDynamicRelationGroupComponent, {
|
||||||
|
remove: {
|
||||||
|
imports: [ThemedLoadingComponent, ChipsComponent, forwardRef(() => FormComponent)]
|
||||||
|
}
|
||||||
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('', () => {
|
// TODO: enable and fix this
|
||||||
|
xdescribe('', () => {
|
||||||
// synchronous beforeEach
|
// synchronous beforeEach
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
html = `<ds-dynamic-relation-group [model]="model"
|
html = `<ds-dynamic-relation-group [model]="model"
|
||||||
@@ -165,7 +172,8 @@ xdescribe('DsDynamicRelationGroupComponent test suite', () => {
|
|||||||
testComp = null;
|
testComp = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create DsDynamicRelationGroupComponent', inject([DsDynamicRelationGroupComponent], (app: DsDynamicRelationGroupComponent) => {
|
// TODO: enable and fix this
|
||||||
|
xit('should create DsDynamicRelationGroupComponent', inject([DsDynamicRelationGroupComponent], (app: DsDynamicRelationGroupComponent) => {
|
||||||
|
|
||||||
expect(app).toBeDefined();
|
expect(app).toBeDefined();
|
||||||
}));
|
}));
|
||||||
@@ -193,7 +201,8 @@ xdescribe('DsDynamicRelationGroupComponent test suite', () => {
|
|||||||
groupComp = null;
|
groupComp = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should init component properly', inject([FormBuilderService], (service: FormBuilderService) => {
|
// TODO: enable and fix this
|
||||||
|
xit('should init component properly', inject([FormBuilderService], (service: FormBuilderService) => {
|
||||||
const formConfig = { rows: groupComp.model.formConfiguration } as SubmissionFormsModel;
|
const formConfig = { rows: groupComp.model.formConfiguration } as SubmissionFormsModel;
|
||||||
const formModel = service.modelFromConfiguration(submissionId, formConfig, groupComp.model.scopeUUID, {}, groupComp.model.submissionScope, groupComp.model.readOnly);
|
const formModel = service.modelFromConfiguration(submissionId, formConfig, groupComp.model.scopeUUID, {}, groupComp.model.submissionScope, groupComp.model.readOnly);
|
||||||
const chips = new Chips([], 'value', 'dc.contributor.author');
|
const chips = new Chips([], 'value', 'dc.contributor.author');
|
||||||
@@ -204,7 +213,8 @@ xdescribe('DsDynamicRelationGroupComponent test suite', () => {
|
|||||||
expect(groupComp.chips.getChipsItems()).toEqual(chips.getChipsItems());
|
expect(groupComp.chips.getChipsItems()).toEqual(chips.getChipsItems());
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should save a new chips item', () => {
|
// TODO: enable and fix this
|
||||||
|
xit('should save a new chips item', () => {
|
||||||
control1.setValue('test author');
|
control1.setValue('test author');
|
||||||
(model1 as any).value = new FormFieldMetadataValueObject('test author');
|
(model1 as any).value = new FormFieldMetadataValueObject('test author');
|
||||||
control2.setValue('test affiliation');
|
control2.setValue('test affiliation');
|
||||||
@@ -225,7 +235,8 @@ xdescribe('DsDynamicRelationGroupComponent test suite', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should clear form inputs', () => {
|
// TODO: enable and fix this
|
||||||
|
xit('should clear form inputs', () => {
|
||||||
control1.setValue('test author');
|
control1.setValue('test author');
|
||||||
(model1 as any).value = new FormFieldMetadataValueObject('test author');
|
(model1 as any).value = new FormFieldMetadataValueObject('test author');
|
||||||
control2.setValue('test affiliation');
|
control2.setValue('test affiliation');
|
||||||
@@ -267,7 +278,8 @@ xdescribe('DsDynamicRelationGroupComponent test suite', () => {
|
|||||||
groupComp = null;
|
groupComp = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should init component properly', inject([FormBuilderService], (service: FormBuilderService) => {
|
// TODO: enable and fix this
|
||||||
|
xit('should init component properly', inject([FormBuilderService], (service: FormBuilderService) => {
|
||||||
const formConfig = { rows: groupComp.model.formConfiguration } as SubmissionFormsModel;
|
const formConfig = { rows: groupComp.model.formConfiguration } as SubmissionFormsModel;
|
||||||
const formModel = service.modelFromConfiguration(submissionId, formConfig, groupComp.model.scopeUUID, {}, groupComp.model.submissionScope, groupComp.model.readOnly);
|
const formModel = service.modelFromConfiguration(submissionId, formConfig, groupComp.model.scopeUUID, {}, groupComp.model.submissionScope, groupComp.model.readOnly);
|
||||||
const chips = new Chips(modelValue, 'value', 'dc.contributor.author');
|
const chips = new Chips(modelValue, 'value', 'dc.contributor.author');
|
||||||
|
@@ -70,8 +70,7 @@ const jsonPatchOpBuilder: any = jasmine.createSpyObj('jsonPatchOpBuilder', {
|
|||||||
|
|
||||||
const formMetadataMock = ['dc.title', 'dc.description'];
|
const formMetadataMock = ['dc.title', 'dc.description'];
|
||||||
|
|
||||||
// TODO: enable this test suite and fix it
|
describe('SubmissionSectionUploadFileEditComponent test suite', () => {
|
||||||
xdescribe('SubmissionSectionUploadFileEditComponent test suite', () => {
|
|
||||||
|
|
||||||
let comp: SubmissionSectionUploadFileEditComponent;
|
let comp: SubmissionSectionUploadFileEditComponent;
|
||||||
let compAsAny: any;
|
let compAsAny: any;
|
||||||
@@ -119,7 +118,7 @@ xdescribe('SubmissionSectionUploadFileEditComponent test suite', () => {
|
|||||||
SubmissionSectionUploadFileEditComponent,
|
SubmissionSectionUploadFileEditComponent,
|
||||||
NgbModal,
|
NgbModal,
|
||||||
NgbActiveModal,
|
NgbActiveModal,
|
||||||
FormComponent,
|
FormsModule,
|
||||||
{ provide: DsDynamicTypeBindRelationService, useValue: getMockDsDynamicTypeBindRelationService() },
|
{ provide: DsDynamicTypeBindRelationService, useValue: getMockDsDynamicTypeBindRelationService() },
|
||||||
{ provide: APP_CONFIG, useValue: environment },
|
{ provide: APP_CONFIG, useValue: environment },
|
||||||
],
|
],
|
||||||
@@ -190,7 +189,8 @@ xdescribe('SubmissionSectionUploadFileEditComponent test suite', () => {
|
|||||||
compAsAny = null;
|
compAsAny = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should init form model properly', () => {
|
// TODO: enable and fix this
|
||||||
|
xit('should init form model properly', () => {
|
||||||
comp.fileData = fileData;
|
comp.fileData = fileData;
|
||||||
comp.formId = 'testFileForm';
|
comp.formId = 'testFileForm';
|
||||||
const maxStartDate = {year: 2022, month: 1, day: 12};
|
const maxStartDate = {year: 2022, month: 1, day: 12};
|
||||||
@@ -225,7 +225,8 @@ xdescribe('SubmissionSectionUploadFileEditComponent test suite', () => {
|
|||||||
expect(comp.setOptions).toHaveBeenCalled();
|
expect(comp.setOptions).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update form model on group select', () => {
|
// TODO: enable and fix this
|
||||||
|
xit('should update form model on group select', () => {
|
||||||
|
|
||||||
comp.fileData = fileData;
|
comp.fileData = fileData;
|
||||||
comp.formId = 'testFileForm';
|
comp.formId = 'testFileForm';
|
||||||
@@ -335,20 +336,12 @@ xdescribe('SubmissionSectionUploadFileEditComponent test suite', () => {
|
|||||||
template: ``,
|
template: ``,
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [
|
imports: [
|
||||||
|
SubmissionSectionUploadFileEditComponent,
|
||||||
CommonModule,
|
CommonModule,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
|
FormComponent,
|
||||||
ReactiveFormsModule
|
ReactiveFormsModule
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
class TestComponent {
|
class TestComponent {
|
||||||
|
|
||||||
availableGroups;
|
|
||||||
availableAccessConditionOptions;
|
|
||||||
collectionId = mockSubmissionCollectionId;
|
|
||||||
collectionPolicyType;
|
|
||||||
fileIndexes = [];
|
|
||||||
fileList = [];
|
|
||||||
fileNames = [];
|
|
||||||
sectionId = 'upload';
|
|
||||||
submissionId = mockSubmissionId;
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user