summaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main
diff options
context:
space:
mode:
authorWojciech Sliwka <wojciech.sliwka@nokia.com>2019-02-01 10:28:19 +0000
committerGerrit Code Review <gerrit@onap.org>2019-02-01 10:28:19 +0000
commitfd2a54c8aee2bfc4ae2f62a2eac392aad66d2578 (patch)
tree9ac2e136a34e86ab0bf44a05d706ac1597a758af /vid-app-common/src/main
parenta89c613095622ccb529483c0ad37d7f23048989e (diff)
parentec4f95457ec430838feeae6da48d0fd011ddffa9 (diff)
Merge "Introduce JS unit tests into VID"
Diffstat (limited to 'vid-app-common/src/main')
-rwxr-xr-xvid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.js1
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.test.js33
2 files changed, 33 insertions, 1 deletions
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.js
index bb3acad1b..3bf05ea1a 100755
--- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.js
@@ -1583,7 +1583,6 @@ appDS2.controller('TreeCtrl', ['$scope', function ($scope) {
$scope.$broadcast(FIELD.ID.ANGULAR_UI_TREE_EXPANDALL);
};
-
}]);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.test.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.test.js
new file mode 100644
index 000000000..4af9a2982
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.test.js
@@ -0,0 +1,33 @@
+require('./aaiSubscriberController');
+const jestMock = require('jest-mock');
+
+describe('TreeCtrl testing', () => {
+ let $scope;
+ beforeEach(
+ angular.mock.module('app')
+ );
+
+ beforeEach(inject(function (_$controller_) {
+ $scope = {};
+ _$controller_('TreeCtrl', {
+ $scope: $scope
+ });
+ }));
+
+ test('Verify expandAll calls broadcast with expand-all parameter', () => {
+ // given
+ const broadcast = jestMock.fn();
+ $scope.$broadcast = broadcast;
+ FIELD = {
+ ID: {
+ ANGULAR_UI_TREE_EXPANDALL: "angular-ui-tree:expand-all"
+ }
+ };
+ // when
+ $scope.expandAll();
+ // then
+ expect(broadcast).toHaveBeenCalledWith("angular-ui-tree:expand-all");
+ });
+
+});
+