From 4e7da6d36783831ea7ef2d338b51e4b9606f62dc Mon Sep 17 00:00:00 2001 From: Sheean Spoel Date: Wed, 12 Jun 2024 15:39:42 +0200 Subject: [PATCH] Fix unit tests --- .../src/app/app.component.spec.ts | 15 +++++---------- .../src/app/footer/footer.component.spec.ts | 3 +-- .../src/app/home/home.component.spec.ts | 13 ++++++------- .../src/app/menu/menu.component.spec.ts | 7 +++++-- 4 files changed, 17 insertions(+), 21 deletions(-) diff --git a/{{cookiecutter.slug}}/frontend.angular/src/app/app.component.spec.ts b/{{cookiecutter.slug}}/frontend.angular/src/app/app.component.spec.ts index d6bcc2f..876a562 100644 --- a/{{cookiecutter.slug}}/frontend.angular/src/app/app.component.spec.ts +++ b/{{cookiecutter.slug}}/frontend.angular/src/app/app.component.spec.ts @@ -4,31 +4,26 @@ import { RouterTestingModule } from '@angular/router/testing'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import { AppComponent } from './app.component'; -import { FooterComponent } from './footer/footer.component'; -import { MenuComponent } from './menu/menu.component'; describe('AppComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [ - AppComponent, - MenuComponent, - FooterComponent - ], - imports: [NoopAnimationsModule, RouterTestingModule, HttpClientTestingModule] + imports: [ + AppComponent, NoopAnimationsModule, RouterTestingModule, HttpClientTestingModule] }).compileComponents(); })); + it('should create the app', () => { const fixture = TestBed.createComponent(AppComponent); const app = fixture.debugElement.componentInstance; expect(app).toBeTruthy(); }); - it(`should have as title '{{cookiecutter.slug | replace('_', '-')}}'`, () => { + it(`should have as title '{{cookiecutter.project_title}}'`, () => { const fixture = TestBed.createComponent(AppComponent); const app = fixture.debugElement.componentInstance; - expect(app.title).toEqual(`{{cookiecutter.slug | replace('_', '-')}}`); + expect(app.title).toEqual(`{{cookiecutter.project_title}}`); }); it('should render title', () => { diff --git a/{{cookiecutter.slug}}/frontend.angular/src/app/footer/footer.component.spec.ts b/{{cookiecutter.slug}}/frontend.angular/src/app/footer/footer.component.spec.ts index 6ded10e..4d37bbd 100644 --- a/{{cookiecutter.slug}}/frontend.angular/src/app/footer/footer.component.spec.ts +++ b/{{cookiecutter.slug}}/frontend.angular/src/app/footer/footer.component.spec.ts @@ -8,8 +8,7 @@ describe('FooterComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [FooterComponent], - imports: [HttpClientTestingModule] + imports: [FooterComponent, HttpClientTestingModule] }) .compileComponents(); })); diff --git a/{{cookiecutter.slug}}/frontend.angular/src/app/home/home.component.spec.ts b/{{cookiecutter.slug}}/frontend.angular/src/app/home/home.component.spec.ts index 221be49..7426be7 100644 --- a/{{cookiecutter.slug}}/frontend.angular/src/app/home/home.component.spec.ts +++ b/{{cookiecutter.slug}}/frontend.angular/src/app/home/home.component.spec.ts @@ -6,13 +6,12 @@ describe('HomeComponent', () => { let component: HomeComponent; let fixture: ComponentFixture; - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ HomeComponent ], - imports: [ HttpClientTestingModule ] - }) - .compileComponents(); - })); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + imports: [HomeComponent, HttpClientTestingModule] + }) + .compileComponents(); + })); beforeEach(() => { fixture = TestBed.createComponent(HomeComponent); diff --git a/{{cookiecutter.slug}}/frontend.angular/src/app/menu/menu.component.spec.ts b/{{cookiecutter.slug}}/frontend.angular/src/app/menu/menu.component.spec.ts index abbddb5..5e811a4 100644 --- a/{{cookiecutter.slug}}/frontend.angular/src/app/menu/menu.component.spec.ts +++ b/{{cookiecutter.slug}}/frontend.angular/src/app/menu/menu.component.spec.ts @@ -11,8 +11,11 @@ describe('MenuComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [MenuComponent], - imports: [NoopAnimationsModule, RouterTestingModule, HttpClientTestingModule] + imports: [ + MenuComponent, + NoopAnimationsModule, + RouterTestingModule, + HttpClientTestingModule] }).compileComponents(); }));