Mathijs den Burger pushed to branch feature/delete-channel-CHANNELMGR-798 at 
cms-community / hippo-addon-channel-manager


Commits:
13d8fc41 by Mathijs den Burger at 2016-08-22T15:51:10+02:00
CHANNELMGR-798 Remove unused return

- - - - -
26fca2c8 by Mathijs den Burger at 2016-08-22T15:57:43+02:00
CHANNELMGR-798 Split test for error codes in two

One test for ExtResponse errors and another for ErrorStatus errors.

- - - - -


2 changed files:

- frontend-ng/src/angularjs/channel/actions/channelActions.controller.js
- frontend-ng/src/angularjs/utils/feedback.service.spec.js


Changes:

=====================================
frontend-ng/src/angularjs/channel/actions/channelActions.controller.js
=====================================
--- a/frontend-ng/src/angularjs/channel/actions/channelActions.controller.js
+++ b/frontend-ng/src/angularjs/channel/actions/channelActions.controller.js
@@ -95,6 +95,6 @@ export class ChannelActionsCtrl {
       .textContent(this.$translate.instant(key, response.parameterMap))
       .ok(this.$translate.instant('OK'));
 
-    return this.DialogService.show(confirm);
+    this.DialogService.show(confirm);
   }
 }


=====================================
frontend-ng/src/angularjs/utils/feedback.service.spec.js
=====================================
--- a/frontend-ng/src/angularjs/utils/feedback.service.spec.js
+++ b/frontend-ng/src/angularjs/utils/feedback.service.spec.js
@@ -105,7 +105,7 @@ describe('FeedbackService', () => {
     expect($log.info).toHaveBeenCalledWith('another message');
   });
 
-  it('maps error codes using the error map', () => {
+  it('maps ExtResponse error codes using the error map', () => {
     const map = { a: 'A' };
     const response = { errorCode: 'a' };
     FeedbackService.showErrorResponseOnSubpage(response, 'defaultKey', map);
@@ -124,17 +124,20 @@ describe('FeedbackService', () => {
     $translate.instant.calls.reset();
     FeedbackService.showErrorResponse(response, 'defaultKey', map);
     expect($translate.instant).toHaveBeenCalledWith('defaultKey', params);
+  });
 
-    // test an ErrorStatus response i.s.o. an ExtResponse.
-    delete response.data;
-    delete response.errorCode;
-    response.error = 'a';
-    $translate.instant.calls.reset();
+  it('maps ErrorStatus error codes using the error map', () => {
+    const map = { a: 'A' };
+    const response = {
+      error: 'a',
+    };
     FeedbackService.showErrorResponse(response, 'defaultKey', map);
     expect($translate.instant).toHaveBeenCalledWith('A', undefined);
 
+    const params = { trans: 'parent' };
     response.parameterMap = params;
     response.error = 'c';
+    $translate.instant.calls.reset();
     FeedbackService.showErrorResponse(response, 'defaultKey', map);
     expect($translate.instant).toHaveBeenCalledWith('defaultKey', params);
   });



View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-addon-channel-manager/compare/1ee719b8b5ae210bee041515d4246e3962f2a097...26fca2c8e8c572df062b7f9b5268ec054f53eb59
_______________________________________________
Hippocms-svn mailing list
Hippocms-svn@lists.onehippo.org
https://lists.onehippo.org/mailman/listinfo/hippocms-svn

Reply via email to