From 9f964df320be856afc2a973218f1b09d9665b177 Mon Sep 17 00:00:00 2001 From: Mike Brocchi Date: Wed, 12 Oct 2016 22:32:04 -0400 Subject: [PATCH] chore: update component spec file to use TestBed --- .../files/__path__/__name__.component.spec.ts | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/packages/angular-cli/blueprints/component/files/__path__/__name__.component.spec.ts b/packages/angular-cli/blueprints/component/files/__path__/__name__.component.spec.ts index e7ed84fac3d2..dd1fec0b6e9e 100644 --- a/packages/angular-cli/blueprints/component/files/__path__/__name__.component.spec.ts +++ b/packages/angular-cli/blueprints/component/files/__path__/__name__.component.spec.ts @@ -1,11 +1,28 @@ /* tslint:disable:no-unused-variable */ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { By } from '@angular/platform-browser'; +import { DebugElement } from '@angular/core'; -import { TestBed, async } from '@angular/core/testing'; import { <%= classifiedModuleName %>Component } from './<%= dasherizedModuleName %>.component'; -describe('Component: <%= classifiedModuleName %>', () => { - it('should create an instance', () => { - let component = new <%= classifiedModuleName %>Component(); +describe('<%= classifiedModuleName %>Component', () => { + let component: <%= classifiedModuleName %>Component; + let fixture: ComponentFixture<<%= classifiedModuleName %>Component>; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ <%= classifiedModuleName %>Component ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(<%= classifiedModuleName %>Component); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { expect(component).toBeTruthy(); }); });