Tobias Jeger pushed to branch feature/cmng-psp1 at cms-community / 
hippo-addon-channel-manager


Commits:
23110f0c by Tobias Jeger at 2016-03-08T12:05:20+01:00
CHANNELMGR-466: Add unit tests after refactoring.

- - - - -


1 changed file:

- frontend-ng/src/angularjs/api/channel.service.spec.js


Changes:

=====================================
frontend-ng/src/angularjs/api/channel.service.spec.js
=====================================
--- a/frontend-ng/src/angularjs/api/channel.service.spec.js
+++ b/frontend-ng/src/angularjs/api/channel.service.spec.js
@@ -44,7 +44,6 @@ describe('ChannelService', function () {
       'load',
       'getComponents',
     ]);
-    CatalogServiceMock.getComponents.and.returnValue([]);
 
     ConfigServiceMock = jasmine.createSpyObj('ConfigService', 
['setContextPath']);
     ConfigServiceMock.apiUrlPrefix = '/testApiUrlPrefix';
@@ -168,4 +167,19 @@ describe('ChannelService', function () {
   });
   // TODO: add a test where the server returns an error upon the 
ChannelService's request for channel details.
 
+  it('should trigger loading of the channel\'s catalog', function () {
+    ChannelService.load({ mountId: '1234' });
+    $rootScope.$digest();
+    expect(CatalogServiceMock.load).toHaveBeenCalledWith('1234');
+  });
+
+  it('should relay the request for catalog components to the CatalogService', 
function () {
+    var mockCatalog = [
+      { label: 'componentA' },
+      { label: 'componentB' },
+    ];
+    CatalogServiceMock.getComponents.and.returnValue(mockCatalog);
+    expect(ChannelService.getCatalog()).toEqual(mockCatalog);
+  });
+
 });



View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-addon-channel-manager/commit/23110f0c345d4e70a69c76943180ef8660663057
_______________________________________________
Hippocms-svn mailing list
Hippocms-svn@lists.onehippo.org
https://lists.onehippo.org/mailman/listinfo/hippocms-svn

Reply via email to