Skip to content

Commit

Permalink
fix: frontend tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmetcanay committed Jun 12, 2024
1 parent 25fb169 commit 21b5a56
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
13 changes: 5 additions & 8 deletions frontend/src/app/footer/footer.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand All @@ -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);
Expand Down Expand Up @@ -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]);
});
Expand Down
7 changes: 6 additions & 1 deletion frontend/src/app/home/home.component.spec.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -10,7 +12,10 @@ describe('HomeComponent', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [HomeComponent],
imports: [
HomeComponent,
HttpClientModule // Add HttpClientModule to the imports
],
providers: [
{
provide: ActivatedRoute,
Expand Down

0 comments on commit 21b5a56

Please sign in to comment.