Skip to content
This repository has been archived by the owner on Apr 4, 2022. It is now read-only.

Commit

Permalink
refactor appComponent test - destroy fixture after
Browse files Browse the repository at this point in the history
  • Loading branch information
tboeckmann committed Sep 28, 2019
1 parent af262c2 commit d69d5c4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { TestBed, async } from '@angular/core/testing';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';
import { HttpClientModule } from '@angular/common/http';

describe('AppComponent', () => {
let fixture: ComponentFixture<AppComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
Expand All @@ -16,8 +18,16 @@ describe('AppComponent', () => {
}).compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
});

afterEach(() => {
fixture.destroy();
});

it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
});
Expand Down

0 comments on commit d69d5c4

Please sign in to comment.