From ecb814df48604abcf30644b96d84da1125cf019c Mon Sep 17 00:00:00 2001 From: Jelte van Boheemen Date: Thu, 3 Oct 2024 16:07:52 +0200 Subject: [PATCH] Fix frontend test imports --- .../corpus-definition.service.spec.ts | 3 +- .../corpus-form/corpus-form.component.spec.ts | 2 ++ .../meta-form/meta-form.component.spec.ts | 29 ++++++++-------- .../upload-sample.component.spec.ts | 34 +++++++++++-------- 4 files changed, 38 insertions(+), 30 deletions(-) diff --git a/frontend/src/app/corpus-definitions/corpus-definition.service.spec.ts b/frontend/src/app/corpus-definitions/corpus-definition.service.spec.ts index ab806149d..d85a02111 100644 --- a/frontend/src/app/corpus-definitions/corpus-definition.service.spec.ts +++ b/frontend/src/app/corpus-definitions/corpus-definition.service.spec.ts @@ -1,13 +1,14 @@ import { TestBed } from '@angular/core/testing'; import { CorpusDefinitionService } from './corpus-definition.service'; +import { SlugifyPipe } from '@shared/pipes/slugify.pipe'; describe('CorpusDefinitionService', () => { let service: CorpusDefinitionService; beforeEach(() => { TestBed.configureTestingModule({ - providers: [CorpusDefinitionService], + providers: [CorpusDefinitionService, SlugifyPipe], }); service = TestBed.inject(CorpusDefinitionService); }); diff --git a/frontend/src/app/corpus-definitions/form/corpus-form/corpus-form.component.spec.ts b/frontend/src/app/corpus-definitions/form/corpus-form/corpus-form.component.spec.ts index 65c161aa3..e09460c8d 100644 --- a/frontend/src/app/corpus-definitions/form/corpus-form/corpus-form.component.spec.ts +++ b/frontend/src/app/corpus-definitions/form/corpus-form/corpus-form.component.spec.ts @@ -3,6 +3,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { CorpusFormComponent } from './corpus-form.component'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import { RouterTestingModule } from '@angular/router/testing'; +import { SlugifyPipe } from '@shared/pipes/slugify.pipe'; describe('CorpusFormComponent', () => { let component: CorpusFormComponent; @@ -12,6 +13,7 @@ describe('CorpusFormComponent', () => { await TestBed.configureTestingModule({ declarations: [CorpusFormComponent], imports: [HttpClientTestingModule, RouterTestingModule], + providers: [SlugifyPipe], }).compileComponents(); fixture = TestBed.createComponent(CorpusFormComponent); diff --git a/frontend/src/app/corpus-definitions/form/meta-form/meta-form.component.spec.ts b/frontend/src/app/corpus-definitions/form/meta-form/meta-form.component.spec.ts index 62470709f..7eb6eba5b 100644 --- a/frontend/src/app/corpus-definitions/form/meta-form/meta-form.component.spec.ts +++ b/frontend/src/app/corpus-definitions/form/meta-form/meta-form.component.spec.ts @@ -2,23 +2,24 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MetaFormComponent } from './meta-form.component'; import { CorpusDefinitionService } from 'app/corpus-definitions/corpus-definition.service'; +import { SlugifyPipe } from '@shared/pipes/slugify.pipe'; describe('MetaFormComponent', () => { - let component: MetaFormComponent; - let fixture: ComponentFixture; + let component: MetaFormComponent; + let fixture: ComponentFixture; - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [MetaFormComponent], - providers: [CorpusDefinitionService], - }).compileComponents(); + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [MetaFormComponent], + providers: [CorpusDefinitionService, SlugifyPipe], + }).compileComponents(); - fixture = TestBed.createComponent(MetaFormComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + fixture = TestBed.createComponent(MetaFormComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/frontend/src/app/corpus-definitions/form/upload-sample/upload-sample.component.spec.ts b/frontend/src/app/corpus-definitions/form/upload-sample/upload-sample.component.spec.ts index 7bb6b0fbd..d10f29e6d 100644 --- a/frontend/src/app/corpus-definitions/form/upload-sample/upload-sample.component.spec.ts +++ b/frontend/src/app/corpus-definitions/form/upload-sample/upload-sample.component.spec.ts @@ -1,23 +1,27 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { UploadSampleComponent } from './upload-sample.component'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { CorpusDefinitionService } from 'app/corpus-definitions/corpus-definition.service'; +import { SlugifyPipe } from '@shared/pipes/slugify.pipe'; describe('UploadSampleComponent', () => { - let component: UploadSampleComponent; - let fixture: ComponentFixture; + let component: UploadSampleComponent; + let fixture: ComponentFixture; - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [UploadSampleComponent] - }) - .compileComponents(); - - fixture = TestBed.createComponent(UploadSampleComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [UploadSampleComponent], + imports: [HttpClientTestingModule], + providers: [CorpusDefinitionService, SlugifyPipe], + }).compileComponents(); - it('should create', () => { - expect(component).toBeTruthy(); - }); + fixture = TestBed.createComponent(UploadSampleComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); });