We can also write an integration test that will exercise the whole application.
import {TestBed, async, ComponentFixture, inject} from '@angular/core/testing';
import {AppCmp} from './app.component';
import {AppModule} from './app.module';
import {App} from "./app";
describe('AppCmp', () => {
let component: AppCmp;
let fixture: ComponentFixture<AppCmp>;
let el: Element;
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [AppModule]
});
TestBed.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AppCmp);
component = fixture.componentInstance;
fixture.detectChanges();
el = fixture.debugElement.nativeElement;
});
it('should filter talks by title', async(inject([App], \
(app: App) => {
app.model.talks = [
{
"id": 1,
...