mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
ACS-8770: fixes test with rejected promise improper usage
This commit is contained in:
@@ -84,7 +84,7 @@ describe('LibraryFavoriteDirective', () => {
|
||||
});
|
||||
|
||||
it('should call addFavorite() and display snackbar message on click event when selection is not a favorite', async () => {
|
||||
spyOn(component.directive.favoritesApi, 'getFavoriteSite').and.returnValue(Promise.reject(new Error('error')));
|
||||
spyOn(component.directive.favoritesApi, 'getFavoriteSite').and.callFake(() => Promise.reject(new Error('error')));
|
||||
spyOn(component.directive.favoritesApi, 'createFavorite').and.returnValue(Promise.resolve(null));
|
||||
spyOn(notificationService, 'showInfo');
|
||||
|
||||
@@ -99,6 +99,7 @@ describe('LibraryFavoriteDirective', () => {
|
||||
await fixture.whenStable();
|
||||
|
||||
expect(component.directive.favoritesApi.createFavorite).toHaveBeenCalled();
|
||||
expect(component.directive.favoritesApi.getFavoriteSite).not.toHaveBeenCalled();
|
||||
expect(notificationService.showInfo).toHaveBeenCalledWith('NODE_FAVORITE_DIRECTIVE.MESSAGES.NODE_ADDED', null, { name: 'Site' });
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user