import { AppComponent } from './app.component' ; import { expect , it , iit , xit , describe , ddescribe , xdescribe , beforeEach , beforeEachProviders , withProviders , async , inject } from '@angular/core/testing' ; import { TestComponentBuilder } from '@angular/compiler/testing' ; import { By } from '@angular/platform-browser' ; import { provide } from '@angular/core' ; import { ViewMetadata } from '@angular/core' ; import { PromiseWrapper } from '@angular/core/src/facade/promise' ; describe ( 'Smoke test' , ( ) => { it ( 'should run a passing test' , ( ) => { expect ( true ) . toEqual ( true , 'should pass' ) ; } ) ; } ) ; describe ( 'AppComponent with TCB' , function ( ) { it ( 'should instantiate component' , async ( inject ( [ TestComponentBuilder ] , ( tcb ) => { tcb . createAsync ( AppComponent ) . then ( fixture => { expect ( fixture . componentInstance instanceof AppComponent ) . toBe ( true , 'should create AppComponent' ) ; } ) ; } ) ) ) ; it ( 'should have expected <h1> text' , async ( inject ( [ TestComponentBuilder ] , ( tcb ) => { tcb . createAsync ( AppComponent ) . then ( fixture => { let h1 = fixture . debugElement . query ( el => el . name === 'h1' ) . nativeElement ; h1 = fixture . debugElement . query ( By . css ( 'h1' ) ) . nativeElement ; expect ( h1 . innerText ) . toMatch ( /angular 2 app/i , '<h1> should say something about "Angular 2 App"' ) ; } ) ; } ) ) ) ; } ) ;