December 2017
Beginner
372 pages
10h 32m
English
Our first it function is pretty straightforward, where we check if there is no JSON object, do we get the board object as undefined? As we know in our Trello service code, if the Board array object is undefined, we would make an HTTP call. That's what we will do in our test case.
The following is our code for the first test case:
it('get Boards undefined',()=>{ mockHTTP.get.and.returnValue(Observable.of(fakeBoards)); trelloService.getBoardsWithPromises().then(boards => this.boards = boards); expect(fakeBoards).toBeUndefined(); });
The first line inside our it function is another feature of Jasmine. In our beforeEach function, we had created the mockHTTP object using Jasmine's createspy object. There, we also define that ...
Read now
Unlock full access