diff --git a/src/app/root/root.component.spec.ts b/src/app/root/root.component.spec.ts index 93ce6a5954..0d37633c7c 100644 --- a/src/app/root/root.component.spec.ts +++ b/src/app/root/root.component.spec.ts @@ -30,8 +30,7 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { NotificationsBoardComponent } from '../shared/notifications/notifications-board/notifications-board.component'; import { SystemWideAlertBannerComponent } from '../system-wide-alert/alert-banner/system-wide-alert-banner.component'; -// TODO: enable this test suite and fix it -xdescribe('RootComponent', () => { +describe('RootComponent', () => { let component: RootComponent; let fixture: ComponentFixture; diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.component.spec.ts index a6126175e9..3eaa74467b 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.component.spec.ts @@ -1,5 +1,5 @@ // 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 { FormsModule, ReactiveFormsModule, UntypedFormControl, UntypedFormGroup } from '@angular/forms'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; @@ -30,6 +30,8 @@ import { SubmissionObjectDataService } from '../../../../../../core/submission/s import { SubmissionService } from '../../../../../../submission/submission.service'; import { APP_CONFIG } from 'src/config/app-config.interface'; 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; @@ -94,8 +96,7 @@ function init() { } -// TODO: enable this test suite and fix it -xdescribe('DsDynamicRelationGroupComponent test suite', () => { +describe('DsDynamicRelationGroupComponent test suite', () => { let testComp: TestComponent; let groupComp: DsDynamicRelationGroupComponent; let testFixture: ComponentFixture; @@ -142,11 +143,17 @@ xdescribe('DsDynamicRelationGroupComponent test suite', () => { ], schemas: [CUSTOM_ELEMENTS_SCHEMA] }) + .overrideComponent(DsDynamicRelationGroupComponent, { + remove: { + imports: [ThemedLoadingComponent, ChipsComponent, forwardRef(() => FormComponent)] + } + }) .compileComponents(); })); - describe('', () => { + // TODO: enable and fix this + xdescribe('', () => { // synchronous beforeEach beforeEach(() => { html = ` { 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(); })); @@ -193,7 +201,8 @@ xdescribe('DsDynamicRelationGroupComponent test suite', () => { 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 formModel = service.modelFromConfiguration(submissionId, formConfig, groupComp.model.scopeUUID, {}, groupComp.model.submissionScope, groupComp.model.readOnly); const chips = new Chips([], 'value', 'dc.contributor.author'); @@ -204,7 +213,8 @@ xdescribe('DsDynamicRelationGroupComponent test suite', () => { 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'); (model1 as any).value = new FormFieldMetadataValueObject('test author'); 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'); (model1 as any).value = new FormFieldMetadataValueObject('test author'); control2.setValue('test affiliation'); @@ -267,7 +278,8 @@ xdescribe('DsDynamicRelationGroupComponent test suite', () => { 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 formModel = service.modelFromConfiguration(submissionId, formConfig, groupComp.model.scopeUUID, {}, groupComp.model.submissionScope, groupComp.model.readOnly); const chips = new Chips(modelValue, 'value', 'dc.contributor.author'); diff --git a/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.spec.ts b/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.spec.ts index ad0be37056..e531a4df67 100644 --- a/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.spec.ts +++ b/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.spec.ts @@ -70,8 +70,7 @@ const jsonPatchOpBuilder: any = jasmine.createSpyObj('jsonPatchOpBuilder', { const formMetadataMock = ['dc.title', 'dc.description']; -// TODO: enable this test suite and fix it -xdescribe('SubmissionSectionUploadFileEditComponent test suite', () => { +describe('SubmissionSectionUploadFileEditComponent test suite', () => { let comp: SubmissionSectionUploadFileEditComponent; let compAsAny: any; @@ -119,7 +118,7 @@ xdescribe('SubmissionSectionUploadFileEditComponent test suite', () => { SubmissionSectionUploadFileEditComponent, NgbModal, NgbActiveModal, - FormComponent, + FormsModule, { provide: DsDynamicTypeBindRelationService, useValue: getMockDsDynamicTypeBindRelationService() }, { provide: APP_CONFIG, useValue: environment }, ], @@ -190,7 +189,8 @@ xdescribe('SubmissionSectionUploadFileEditComponent test suite', () => { compAsAny = null; }); - it('should init form model properly', () => { + // TODO: enable and fix this + xit('should init form model properly', () => { comp.fileData = fileData; comp.formId = 'testFileForm'; const maxStartDate = {year: 2022, month: 1, day: 12}; @@ -225,7 +225,8 @@ xdescribe('SubmissionSectionUploadFileEditComponent test suite', () => { 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.formId = 'testFileForm'; @@ -331,24 +332,16 @@ xdescribe('SubmissionSectionUploadFileEditComponent test suite', () => { // declare a test component @Component({ - selector: 'ds-test-cmp', - template: ``, - standalone: true, - imports: [ - CommonModule, - FormsModule, - ReactiveFormsModule - ] + selector: 'ds-test-cmp', + template: ``, + standalone: true, + imports: [ + SubmissionSectionUploadFileEditComponent, + CommonModule, + FormsModule, + FormComponent, + ReactiveFormsModule + ] }) class TestComponent { - - availableGroups; - availableAccessConditionOptions; - collectionId = mockSubmissionCollectionId; - collectionPolicyType; - fileIndexes = []; - fileList = []; - fileNames = []; - sectionId = 'upload'; - submissionId = mockSubmissionId; }