mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-11 20:13:07 +00:00
[DURACOM-191] fix tests in section-upload-file-edit component
This commit is contained in:
@@ -203,7 +203,6 @@ describe('DsDynamicRelationGroupComponent test suite', () => {
|
|||||||
groupComp = null;
|
groupComp = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: enable and fix this
|
|
||||||
it('should init component properly', inject([FormBuilderService], (service: FormBuilderService) => {
|
it('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);
|
||||||
|
@@ -70,6 +70,22 @@ const jsonPatchOpBuilder: any = jasmine.createSpyObj('jsonPatchOpBuilder', {
|
|||||||
|
|
||||||
const formMetadataMock = ['dc.title', 'dc.description'];
|
const formMetadataMock = ['dc.title', 'dc.description'];
|
||||||
|
|
||||||
|
const initialState: any = {
|
||||||
|
core: {
|
||||||
|
'bitstreamFormats': {},
|
||||||
|
'cache/object': {},
|
||||||
|
'cache/syncbuffer': {},
|
||||||
|
'cache/object-updates': {},
|
||||||
|
'data/request': {},
|
||||||
|
'history': {},
|
||||||
|
'index': {},
|
||||||
|
'auth': {},
|
||||||
|
'json/patch': {},
|
||||||
|
'metaTag': {},
|
||||||
|
'route': {},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
describe('SubmissionSectionUploadFileEditComponent test suite', () => {
|
describe('SubmissionSectionUploadFileEditComponent test suite', () => {
|
||||||
|
|
||||||
let comp: SubmissionSectionUploadFileEditComponent;
|
let comp: SubmissionSectionUploadFileEditComponent;
|
||||||
@@ -94,6 +110,10 @@ describe('SubmissionSectionUploadFileEditComponent test suite', () => {
|
|||||||
const fileData: any = mockUploadFiles[0];
|
const fileData: any = mockUploadFiles[0];
|
||||||
const pathCombiner = new JsonPatchOperationPathCombiner('sections', sectionId, 'files', fileIndex);
|
const pathCombiner = new JsonPatchOperationPathCombiner('sections', sectionId, 'files', fileIndex);
|
||||||
|
|
||||||
|
const mockCdRef = Object.assign({
|
||||||
|
detectChanges: () => undefined
|
||||||
|
});
|
||||||
|
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
@@ -112,13 +132,12 @@ describe('SubmissionSectionUploadFileEditComponent test suite', () => {
|
|||||||
{ provide: SubmissionJsonPatchOperationsService, useValue: submissionJsonPatchOperationsServiceStub },
|
{ provide: SubmissionJsonPatchOperationsService, useValue: submissionJsonPatchOperationsServiceStub },
|
||||||
{ provide: JsonPatchOperationsBuilder, useValue: jsonPatchOpBuilder },
|
{ provide: JsonPatchOperationsBuilder, useValue: jsonPatchOpBuilder },
|
||||||
{ provide: SectionUploadService, useValue: getMockSectionUploadService() },
|
{ provide: SectionUploadService, useValue: getMockSectionUploadService() },
|
||||||
provideMockStore({}),
|
provideMockStore({initialState}),
|
||||||
FormBuilderService,
|
FormBuilderService,
|
||||||
ChangeDetectorRef,
|
{provide: ChangeDetectorRef, useValue: mockCdRef},
|
||||||
SubmissionSectionUploadFileEditComponent,
|
SubmissionSectionUploadFileEditComponent,
|
||||||
NgbModal,
|
NgbModal,
|
||||||
NgbActiveModal,
|
NgbActiveModal,
|
||||||
FormsModule,
|
|
||||||
{ provide: DsDynamicTypeBindRelationService, useValue: getMockDsDynamicTypeBindRelationService() },
|
{ provide: DsDynamicTypeBindRelationService, useValue: getMockDsDynamicTypeBindRelationService() },
|
||||||
{ provide: APP_CONFIG, useValue: environment },
|
{ provide: APP_CONFIG, useValue: environment },
|
||||||
],
|
],
|
||||||
@@ -189,14 +208,13 @@ describe('SubmissionSectionUploadFileEditComponent test suite', () => {
|
|||||||
compAsAny = null;
|
compAsAny = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: enable and fix this
|
it('should init form model properly', () => {
|
||||||
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};
|
||||||
const maxEndDate = {year: 2019, month: 7, day: 12};
|
const maxEndDate = {year: 2019, month: 7, day: 12};
|
||||||
|
|
||||||
comp.ngOnInit();
|
comp.formModel = compAsAny.buildFileEditForm();
|
||||||
|
|
||||||
expect(comp.formModel).toBeDefined();
|
expect(comp.formModel).toBeDefined();
|
||||||
expect(comp.formModel.length).toBe(2);
|
expect(comp.formModel.length).toBe(2);
|
||||||
@@ -225,13 +243,12 @@ describe('SubmissionSectionUploadFileEditComponent test suite', () => {
|
|||||||
expect(comp.setOptions).toHaveBeenCalled();
|
expect(comp.setOptions).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: enable and fix this
|
it('should update form model on group select', () => {
|
||||||
xit('should update form model on group select', () => {
|
|
||||||
|
|
||||||
comp.fileData = fileData;
|
comp.fileData = fileData;
|
||||||
comp.formId = 'testFileForm';
|
comp.formId = 'testFileForm';
|
||||||
|
|
||||||
comp.ngOnInit();
|
comp.formModel = compAsAny.buildFileEditForm();
|
||||||
|
|
||||||
const model: DynamicSelectModel<string> = formbuilderService.findById('name', comp.formModel, 0);
|
const model: DynamicSelectModel<string> = formbuilderService.findById('name', comp.formModel, 0);
|
||||||
const formGroup = formbuilderService.createFormGroup(comp.formModel);
|
const formGroup = formbuilderService.createFormGroup(comp.formModel);
|
||||||
|
Reference in New Issue
Block a user