Skip to content

Commit

Permalink
replace more cases
Browse files Browse the repository at this point in the history
  • Loading branch information
DenysVuika committed Aug 2, 2024
1 parent 4530781 commit a19d966
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ describe('ContentManagementService', () => {
let appHookService: AppHookService;
let newVersionUploaderService: NewVersionUploaderService;
let showErrorSpy: jasmine.Spy;
let showInfoSpy: jasmine.Spy;

beforeEach(() => {
TestBed.configureTestingModule({
Expand All @@ -92,6 +93,7 @@ describe('ContentManagementService', () => {
contentManagementService = TestBed.inject(ContentManagementService);
notificationService = TestBed.inject(NotificationService);
showErrorSpy = spyOn(notificationService, 'showError');
showInfoSpy = spyOn(notificationService, 'showInfo');
nodeActions = TestBed.inject(NodeActionsService);
translationService = TestBed.inject(TranslationService);
nodesApiService = TestBed.inject(NodesApiService);
Expand Down Expand Up @@ -1782,7 +1784,7 @@ describe('ContentManagementService', () => {
contentManagementService.deleteLibrary(libraryId);
tick();

expect(store.dispatch).toHaveBeenCalledWith(new SnackbarInfoAction('APP.MESSAGES.INFO.LIBRARY_DELETED'));
expect(showInfoSpy).toHaveBeenCalledWith('APP.MESSAGES.INFO.LIBRARY_DELETED');
expect(store.dispatch).toHaveBeenCalledWith(new NavigateRouteAction(['/libraries']));
}));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ export class ContentManagementService {
this.contentApi.deleteSite(id).subscribe(
() => {
this.appHookService.libraryDeleted.next(id);
this.store.dispatch(new SnackbarInfoAction('APP.MESSAGES.INFO.LIBRARY_DELETED'));
this.notificationService.showInfo('APP.MESSAGES.INFO.LIBRARY_DELETED');
this.store.dispatch(new NavigateRouteAction(['/libraries']));
},
() => {
Expand All @@ -311,7 +311,7 @@ export class ContentManagementService {
this.contentApi.leaveSite(siteId).subscribe(
() => {
this.appHookService.libraryLeft.next(siteId);
this.store.dispatch(new SnackbarInfoAction('APP.MESSAGES.INFO.LEFT_LIBRARY'));
this.notificationService.showInfo('APP.MESSAGES.INFO.LEFT_LIBRARY');
},
() => {
this.notificationService.showError('APP.MESSAGES.ERRORS.LEAVE_LIBRARY_FAILED');
Expand All @@ -326,7 +326,7 @@ export class ContentManagementService {
this.contentApi.updateLibrary(siteId, siteBody).subscribe(
(siteEntry: SiteEntry) => {
this.appHookService.libraryUpdated.next(siteEntry);
this.store.dispatch(new SnackbarInfoAction('LIBRARY.SUCCESS.LIBRARY_UPDATED'));
this.notificationService.showInfo('LIBRARY.SUCCESS.LIBRARY_UPDATED');
},
() => {
this.notificationService.showError('LIBRARY.ERRORS.LIBRARY_UPDATE_ERROR');
Expand Down

0 comments on commit a19d966

Please sign in to comment.