SHARE
TWEET

Untitled

a guest Jun 18th, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. it('should call getBook', async() => {
  2.     // given
  3.     spyOn(booksService, 'getBook');
  4.  
  5.     // when
  6.     const isbn = '9788306021486';
  7.     component.ngOnInit();
  8.     fixture.detectChanges();
  9.     fixture.whenStable().then(() => {
  10.         // then
  11.         expect(booksService.getBook(isbn)).toHaveBeenCalled();
  12.     });
  13. });
  14.  
  15. it('should call addNewBook', async() => {
  16.   // given
  17.   spyOn(booksService, 'addNewBook');
  18.  
  19.   // when
  20.   const book = new Book();
  21.   component.ngOnInit();
  22.   fixture.detectChanges();
  23.   fixture.whenStable().then(() => {
  24.       // then
  25.       expect(booksService.addNewBook(book)).toHaveBeenCalled();
  26.   });
  27. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top