December 2017
Beginner
372 pages
10h 32m
English
The beforeEach function will be the one where we will create our component and its module. We will also define the dependencies and their behavior. In the case of an integrated test, we normally have two beforeEach functions: one to initialize the module, and another to create the component. The following is the code for the former one:
beforeEach(async(() => { let mockTrelloService={ getBoardsWithPromises:()=>Observable.of([]).toPromise()}; TestBed.configureTestingModule({ declarations: [ HomepageComponent ], imports:[RouterModule.forRoot([])], providers: [{provide: APP_BASE_HREF, useValue: '/'}, {provide: TrelloService, useValue:mockTrelloService}] }) .compileComponents();}));
Let's first look at the second line ...
Read now
Unlock full access