From e7b5528ad335f2187abf36facb1a0808c0214cb5 Mon Sep 17 00:00:00 2001 From: Enea Jahollari Date: Thu, 28 Sep 2023 09:50:41 +0200 Subject: [PATCH] fix SubmissionSectionUploadFileComponent tests --- .../section-upload-file.component.spec.ts | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/app/submission/sections/upload/file/section-upload-file.component.spec.ts b/src/app/submission/sections/upload/file/section-upload-file.component.spec.ts index 2d3378f546..bffd74eb1b 100644 --- a/src/app/submission/sections/upload/file/section-upload-file.component.spec.ts +++ b/src/app/submission/sections/upload/file/section-upload-file.component.spec.ts @@ -1,7 +1,7 @@ import { ChangeDetectorRef, Component, NO_ERRORS_SCHEMA } from '@angular/core'; -import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { CommonModule } from '@angular/common'; +import { AsyncPipe, CommonModule } from '@angular/common'; import { of, of as observableOf } from 'rxjs'; import { TranslateModule } from '@ngx-translate/core'; @@ -32,6 +32,9 @@ import { JsonPatchOperationPathCombiner } from '../../../../core/json-patch/buil import { getMockSectionUploadService } from '../../../../shared/mocks/section-upload.service.mock'; import { SubmissionSectionUploadFileEditComponent } from './edit/section-upload-file-edit.component'; import { FormBuilderService } from '../../../../shared/form/builder/form-builder.service'; +import { SubmissionSectionUploadFileViewComponent } from './view/section-upload-file-view.component'; + + const configMetadataFormMock = { rows: [{ @@ -98,7 +101,13 @@ describe('SubmissionSectionUploadFileComponent test suite', () => { FormBuilderService ], schemas: [NO_ERRORS_SCHEMA] -}).compileComponents().then(); +}) + .overrideComponent(SubmissionSectionUploadFileComponent, { + remove: { imports: [ + SubmissionSectionUploadFileViewComponent, + ]} + }) + .compileComponents().then(); })); describe('', () => { @@ -128,9 +137,10 @@ describe('SubmissionSectionUploadFileComponent test suite', () => { testFixture.destroy(); }); - it('should create SubmissionSectionUploadFileComponent', inject([SubmissionSectionUploadFileComponent], (app: SubmissionSectionUploadFileComponent) => { + it('should create SubmissionSectionUploadFileComponent', () => { + let app = TestBed.inject(SubmissionSectionUploadFileComponent); expect(app).toBeDefined(); - })); + }); }); describe('', () => { @@ -237,7 +247,9 @@ describe('SubmissionSectionUploadFileComponent test suite', () => { template: ``, standalone: true, imports: [ + SubmissionSectionUploadFileComponent, CommonModule, + AsyncPipe, NgbModule] }) class TestComponent {