import { async , ComponentFixture , TestBed } from '@angular/core/testing' ; import { By } from '@angular/platform-browser' ; import { NotFoundComponent } from './not-found.component' ; describe ( 'NotFoundComponent' , ( ) => { let component ; let fixture ; beforeEach ( async ( ( ) => { TestBed . configureTestingModule ( { declarations : [ NotFoundComponent ] } ) . compileComponents ( ) ; } ) ) ; beforeEach ( ( ) => { fixture = TestBed . createComponent ( NotFoundComponent ) ; component = fixture . componentInstance ; fixture . detectChanges ( ) ; } ) ; it ( 'should create' , ( ) => { expect ( component ) . toBeTruthy ( ) ; } ) ; it ( 'should display the string "404 Not Found" in h4' , ( ) => { const el = fixture . debugElement . query ( By . css ( 'h4' ) ) . nativeElement ; expect ( el . textContent ) . toContain ( '404 Not Found' ) ; } ) ; } ) ;