From ec4f95457ec430838feeae6da48d0fd011ddffa9 Mon Sep 17 00:00:00 2001 From: golabek Date: Mon, 28 Jan 2019 09:34:48 +0100 Subject: Introduce JS unit tests into VID maven -> npm -> gulp -> jest frameworks added in a mentioned order. Change-Id: I1865228973eb31188fb052e8c9629f0ac01e48a7 Issue-ID: VID-391 Signed-off-by: Tomasz Golabek --- .../controller/aaiSubscriberController.test.js | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.test.js (limited to 'vid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.test.js') 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"); + }); + +}); + -- cgit 1.2.3-korg