Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- it('should call getBook', async() => {
- // given
- spyOn(booksService, 'getBook');
- // when
- const isbn = '9788306021486';
- component.ngOnInit();
- fixture.detectChanges();
- fixture.whenStable().then(() => {
- // then
- expect(booksService.getBook(isbn)).toHaveBeenCalled();
- });
- });
- it('should call addNewBook', async() => {
- // given
- spyOn(booksService, 'addNewBook');
- // when
- const book = new Book();
- component.ngOnInit();
- fixture.detectChanges();
- fixture.whenStable().then(() => {
- // then
- expect(booksService.addNewBook(book)).toHaveBeenCalled();
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement