import { TestBed, async } from '@angular/core/testing'; import { APP_BASE_HREF } from '@angular/common'; import { RouterModule, Routes } from '@angular/router'; import { AppComponent } from './app.component'; describe('AppComponent', () => { const routes: Routes = [ { path: '', redirectTo: '/policy', pathMatch: 'full'} ]; beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ AppComponent ], imports: [ RouterModule.forRoot(routes) ], providers: [ { provide: APP_BASE_HREF, useValue: '/' } ] }).compileComponents(); })); it('should create the app', async(() => { const fixture = TestBed.createComponent(AppComponent); const app = fixture.debugElement.componentInstance; expect(app).toBeTruthy(); })); it(`should have as title 'controlpanelApp'`, async(() => { const fixture = TestBed.createComponent(AppComponent); const app = fixture.debugElement.componentInstance; expect(app.title).toEqual('controlpanelApp'); })); });