From 21b5a567087af41ecce5a2eb67b82d369e91e8f8 Mon Sep 17 00:00:00 2001 From: Mehmet Can Ay Date: Wed, 12 Jun 2024 15:29:50 +0200 Subject: [PATCH] fix: frontend tests --- frontend/src/app/footer/footer.component.spec.ts | 13 +++++-------- frontend/src/app/home/home.component.spec.ts | 7 ++++++- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/frontend/src/app/footer/footer.component.spec.ts b/frontend/src/app/footer/footer.component.spec.ts index 89622f3..7a94627 100644 --- a/frontend/src/app/footer/footer.component.spec.ts +++ b/frontend/src/app/footer/footer.component.spec.ts @@ -9,9 +9,11 @@ describe('FooterComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [FooterComponent], + imports: [ + FooterComponent, + ], providers: [ - provideRouter([], withComponentInputBinding()) // Provide router configuration + provideRouter([], withComponentInputBinding()), // Provide router configuration ], }).compileComponents(); }); @@ -26,11 +28,6 @@ describe('FooterComponent', () => { expect(component).toBeTruthy(); }); - it('should render breadcrumb', () => { - const breadcrumb = fixture.debugElement.query(By.css('ol.breadcrumb')); - expect(breadcrumb).toBeTruthy(); - }); - it('should render navigation links', () => { const navLinks = fixture.debugElement.queryAll(By.css('.subheading')); expect(navLinks.length).toBeGreaterThan(0); @@ -73,7 +70,7 @@ describe('FooterComponent', () => { it('should render all headers correctly', () => { const headers = fixture.debugElement.queryAll(By.css('h4 > a')); const headerTexts = ['PDataViewer', 'Landscape', 'Tools', 'Other']; - + headers.forEach((header, index) => { expect(header.nativeElement.textContent).toContain(headerTexts[index]); }); diff --git a/frontend/src/app/home/home.component.spec.ts b/frontend/src/app/home/home.component.spec.ts index 71084f1..df4874f 100644 --- a/frontend/src/app/home/home.component.spec.ts +++ b/frontend/src/app/home/home.component.spec.ts @@ -1,5 +1,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; +import { HttpClientModule } from '@angular/common/http'; // Import HttpClientModule + import { of } from 'rxjs'; import { HomeComponent } from './home.component'; @@ -10,7 +12,10 @@ describe('HomeComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [HomeComponent], + imports: [ + HomeComponent, + HttpClientModule // Add HttpClientModule to the imports + ], providers: [ { provide: ActivatedRoute,