Merge "Introduce JS unit tests into VID"
[vid.git] / vid-app-common / src / main / webapp / app / vid / scripts / controller / aaiSubscriberController.test.js
1 require('./aaiSubscriberController');
2 const jestMock = require('jest-mock');
3
4 describe('TreeCtrl testing', () => {
5   let $scope;
6   beforeEach(
7       angular.mock.module('app')
8   );
9
10   beforeEach(inject(function (_$controller_) {
11     $scope = {};
12     _$controller_('TreeCtrl', {
13       $scope: $scope
14     });
15   }));
16
17   test('Verify expandAll calls broadcast with expand-all parameter', () => {
18     // given
19     const broadcast = jestMock.fn();
20     $scope.$broadcast = broadcast;
21     FIELD = {
22       ID: {
23         ANGULAR_UI_TREE_EXPANDALL: "angular-ui-tree:expand-all"
24       }
25     };
26     // when
27     $scope.expandAll();
28     // then
29     expect(broadcast).toHaveBeenCalledWith("angular-ui-tree:expand-all");
30   });
31
32 });
33