Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oktaal committed Jun 12, 2024
1 parent 952d3a2 commit 4e7da6d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ describe('FooterComponent', () => {

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [FooterComponent],
imports: [HttpClientTestingModule]
imports: [FooterComponent, HttpClientTestingModule]
})
.compileComponents();
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ describe('HomeComponent', () => {
let component: HomeComponent;
let fixture: ComponentFixture<HomeComponent>;

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ HomeComponent ],
imports: [ HttpClientTestingModule ]
})
.compileComponents();
}));
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [HomeComponent, HttpClientTestingModule]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(HomeComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ describe('MenuComponent', () => {

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [MenuComponent],
imports: [NoopAnimationsModule, RouterTestingModule, HttpClientTestingModule]
imports: [
MenuComponent,
NoopAnimationsModule,
RouterTestingModule,
HttpClientTestingModule]
}).compileComponents();
}));

Expand Down

0 comments on commit 4e7da6d

Please sign in to comment.