Repository: incubator-griffin Updated Branches: refs/heads/master 06ddc548c -> 07f1a539c
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/07f1a539/service/src/main/resources/public/tests/ut/specs/controllers/createrule-ac-ctrl.spec.js ---------------------------------------------------------------------- diff --git a/service/src/main/resources/public/tests/ut/specs/controllers/createrule-ac-ctrl.spec.js b/service/src/main/resources/public/tests/ut/specs/controllers/createrule-ac-ctrl.spec.js deleted file mode 100644 index bf34dcb..0000000 --- a/service/src/main/resources/public/tests/ut/specs/controllers/createrule-ac-ctrl.spec.js +++ /dev/null @@ -1,129 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ -define(['angular', 'angularMocks', 'js/controllers/createrule-ac-ctrl'], - function(angular, mocks, CreateRuleACCtrl) { - describe('Test /js/controllers/createrule-ac-ctrl.js', function(){ - beforeEach(function(){ - module('app.controllers'); - module('app.services'); - }); - var $scope, $rootScope, $controller, $httpBackend, $config, $location, toaster, $timeout, $route; - beforeEach(inject(function(_$rootScope_ , _$controller_, _$httpBackend_, _$config_, _$location_, _$timeout_){ - $rootScope = _$rootScope_; - $controller = _$controller_; - $httpBackend = _$httpBackend_; - $config = _$config_; - $location = _$location_; - $timeout = _$timeout_; - $route = {}; - toaster = {}; - })); - - beforeEach(function(){ - $scope = $rootScope.$new(); - controller = $controller('CreateRuleACCtrl', {$scope: $scope, $route: $route, toaster: toaster }); - }); - - describe("if the controller of CreateRuleACCtrl exists",function(){ - it('controller exists', function(){ - expect(controller).toBeDefined(); - }); - }) - - describe("check if parameters are available",function(){ - - it('if the controller exists', function(){ - expect(controller).toBeDefined(); - }); - - it('$scope.value and $config.value should be right', function(){ - expect($scope.currentStep).toBe(1); - expect(typeof $scope.selection).toEqual("object"); - expect($config.uri.dbtree).toBeTruthy(); - expect($config.uri.schemadefinition).toBeTruthy(); - }); - - it('$scope.ruleTypes should be right', function(){ - expect($scope.ruleTypes).toEqual(['Accuracy', 'Validity', 'Anomaly Detection', 'Publish Metrics']); - }); - - }) - - describe("check if function are work",function(){ - - it('$scope.selectNodeLabelTarget works well', function(){ - expect($scope.selectNodeLabelTarget ).toBeDefined(); - }); - - it('$scope.toggleSelection works well', function(){ - expect($scope.toggleSelection).toBeDefined(); - }); - - it('$scope.toggleAll works well', function(){ - expect($scope.toggleAll).toBeDefined(); - }); - - it('$scope.form is a object', function(){ - expect(typeof $scope.form).toBe("object"); - }); - - }) - - describe("$scope.form test",function(){ - - it('the type of $scope.form', function(){ - expect(typeof $scope.form).toBe("object"); - }); - - it('the type of $scope.form.submit', function(){ - expect(typeof $scope.form.submit).toBe('function'); - }); - - it('the type of $scope.form.save', function(){ - expect(typeof $scope.form.save).toBe('function'); - }); - - }) - - describe("httpGet $config.uri.dbtree test",function(){ - beforeEach(function(){ - $httpBackend.when('GET', $config.uri.dbtree).respond({"age": 16,"name": "li"}); - $httpBackend.when('GET', $config.uri.schemadefinition).respond({"age": 16,"name": "li"}); - }); - - it('http response', function(){ - $httpBackend.flush(); - expect($scope.dbListTarget).toBeTruthy(); - }); - - it('test watch and http request', function(){ - $scope.currentNode = {"name":"ha"}; - $scope.$digest(); - - $httpBackend.flush(); - expect($scope.selection.length).toBe(0); - expect($scope.selectedAll).toBe(false); - - expect($scope.schemaCollection.age).toBe(16); - }); - - afterEach(function() { - $httpBackend.verifyNoOutstandingExpectation(); - $httpBackend.verifyNoOutstandingRequest(); - }); - }) - }); - } -) http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/07f1a539/service/src/main/resources/public/tests/ut/specs/controllers/createrule-pu-ctrl.spec.js ---------------------------------------------------------------------- diff --git a/service/src/main/resources/public/tests/ut/specs/controllers/createrule-pu-ctrl.spec.js b/service/src/main/resources/public/tests/ut/specs/controllers/createrule-pu-ctrl.spec.js deleted file mode 100644 index 9bf9af2..0000000 --- a/service/src/main/resources/public/tests/ut/specs/controllers/createrule-pu-ctrl.spec.js +++ /dev/null @@ -1,105 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ -define(['angular', 'angularMocks', 'js/controllers/createrule-pu-ctrl'], - function(angular, mocks, CreateRulePUCtrl) { - describe('Test /js/controllers/createrule-pu-ctrl.js', function(){ - beforeEach(function(){ - module('app.controllers'); - module('app.services'); - }); - var $scope, $rootScope, $controller, $httpBackend, $config, $location, toaster, $timeout, $route; - beforeEach(inject(function(_$rootScope_ , _$controller_, _$httpBackend_, _$config_, _$location_, _$timeout_){ - $rootScope = _$rootScope_; - $controller = _$controller_; - $httpBackend = _$httpBackend_; - $config = _$config_; - $location = _$location_; - $timeout = _$timeout_; - $route = {}; - toaster = ['error', 'Error', "hello", "lisan"];/*test data*/ - })); - - beforeEach(function(){ - $scope = $rootScope.$new(); - controller = $controller('CreateRulePUCtrl', {$scope: $scope, $route: $route, toaster: toaster }); - }); - - describe("if the controller of CreateRulePUCtrl exists",function(){ - it('controller exists', function(){ - expect(controller).toBeDefined(); - }); - }) - - describe("$scope.value",function(){ - - it('$scope.currentStep == 1', function(){ - expect($scope.currentStep).toBe(1); - }); - - it('$scope.scheduleTypes', function(){ - expect($scope.scheduleTypes).toEqual(['Daily', 'Weekly', 'Monthly', 'Hourly']); - }); - - }) - - describe("$scope.form test",function(){ - - it('the type of $scope.form', function(){ - expect(typeof $scope.form).toBe("object"); - }); - - it('the type of $scope.form.submit', function(){ - expect(typeof $scope.form.submit).toBe('function'); - }); - - it('the type of $scope.form.save', function(){ - expect(typeof $scope.form.save).toBe('function'); - }); - - }) - - /*describe("function errorMessage() test",function(){ - // test function - it('errorMessage', function(){ - var message = ["hello"]; - var i = 2; - var msg = true; - $scope.errorMessage(i,msg); - expect(toaster).toEqual(['error', 'Error',"hello"]); - }); - - })*/ - - describe('Testing $watch expressions', function() { - it('test using $digest', function() { - var form = {}; - form.basic = {"name": "li"}; - form.publishUrl = "publishUrl"; - $scope.form = form; - form.basic.name = "ha"; - $scope.$digest(); - form.basic.name = "la"; - $scope.$digest(); - - expect($scope.form.publishUrl).toEqual('http://dq.vip.ebay.com/api/v1/publishmetric/la'); - - }); - }); - - - - }); - } -) http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/07f1a539/service/src/main/resources/public/tests/ut/specs/controllers/createrule-va-ctrl.spec.js ---------------------------------------------------------------------- diff --git a/service/src/main/resources/public/tests/ut/specs/controllers/createrule-va-ctrl.spec.js b/service/src/main/resources/public/tests/ut/specs/controllers/createrule-va-ctrl.spec.js deleted file mode 100644 index 990ef4e..0000000 --- a/service/src/main/resources/public/tests/ut/specs/controllers/createrule-va-ctrl.spec.js +++ /dev/null @@ -1,110 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ -define(['angular', 'angularMocks', 'js/controllers/createrule-va-ctrl'], - function(angular, mocks, CreateRuleVACtrl) { - describe('Test /js/controllers/createrule-va-ctrl.js', function(){ - beforeEach(function(){ - module('app.controllers'); - module('app.services'); - }); - var $scope, $rootScope, $controller, $httpBackend, $config, $location, toaster, $timeout, $route; - beforeEach(inject(function(_$rootScope_ , _$controller_, _$httpBackend_, _$config_, _$location_, _$timeout_){ - $rootScope = _$rootScope_; - $controller = _$controller_; - $httpBackend = _$httpBackend_; - $config = _$config_; - $location = _$location_; - $timeout = _$timeout_; - $route = {}; - toaster = {}; - })); - - beforeEach(function(){ - $scope = $rootScope.$new(); - controller = $controller('CreateRuleVACtrl', {$scope: $scope, $route: $route, toaster: toaster }); - }); - - describe("if the controller of CreateRuleVACtrl exists",function(){ - it('controller exists', function(){ - expect(controller).toBeDefined(); - }); - }) - - describe("check if parameters are available",function(){ - - it('$scope.value and $config.value should be right', function(){ - expect($scope.currentStep).toBe(1); - expect($config.uri.dbtree).toBeTruthy(); - expect($config.uri.schemadefinition).toBeTruthy(); - }); - - it('$scope.ruleTypes should be right', function(){ - expect($scope.ruleTypes).toEqual(['Accuracy', 'Validity', 'Anomaly Detection', 'Publish Metrics']); - }); - - }) - - describe("check if form function are work",function(){ - - it('$scope.form is a object', function(){ - expect(typeof $scope.form).toBe("object"); - }); - - }) - - describe("$scope.form test",function(){ - - it('the type of $scope.form', function(){ - expect(typeof $scope.form).toBe("object"); - }); - - it('the type of $scope.form.submit', function(){ - expect(typeof $scope.form.submit).toBe('function'); - }); - - it('the type of $scope.form.save', function(){ - expect(typeof $scope.form.save).toBe('function'); - }); - - }) - - describe("httpGet $config.uri.dbtree test",function(){ - beforeEach(function(){ - $httpBackend.when('GET', $config.uri.dbtree).respond({"age": 16,"name": "li"}); - $httpBackend.when('GET', $config.uri.schemadefinition).respond({"age": 15,"name": "wei"}); - }); - - it('http response', function(){ - $httpBackend.flush(); - expect($scope.dbList).toBeTruthy(); - }); - - it('test watch and http request', function(){ - $scope.currentNode = {"name":"ha"}; - $scope.$digest(); - - $httpBackend.flush(); - expect($scope.schemaCollection.age).toBe(15); - }); - - afterEach(function() { - $httpBackend.verifyNoOutstandingExpectation(); - $httpBackend.verifyNoOutstandingRequest(); - }); - }) - - }); - } -) http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/07f1a539/service/src/main/resources/public/tests/ut/specs/controllers/createrule0-ctrl.spec.js ---------------------------------------------------------------------- diff --git a/service/src/main/resources/public/tests/ut/specs/controllers/createrule0-ctrl.spec.js b/service/src/main/resources/public/tests/ut/specs/controllers/createrule0-ctrl.spec.js deleted file mode 100644 index 8df4af1..0000000 --- a/service/src/main/resources/public/tests/ut/specs/controllers/createrule0-ctrl.spec.js +++ /dev/null @@ -1,62 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ -define(['angular', 'angularMocks', 'js/controllers/createrule0-ctrl'], - function(angular, mocks, CreateRule0Ctrl) { - describe('Test /js/controllers/createrule0-ctrl.js', function(){ - beforeEach(function(){ - module('app.controllers'); - module('app.services'); - }); - var $scope, $rootScope, $controller, $httpBackend, $config, $location, toaster, $timeout; - - beforeEach(inject(function(_$rootScope_ , _$controller_, _$httpBackend_, _$config_, _$location_, _$timeout_){ - $rootScope = _$rootScope_; - $controller = _$controller_; - $httpBackend = _$httpBackend_; - $config = _$config_; - $location = _$location_; - $timeout = _$timeout_; - toaster = {}; - })); - - beforeEach(function(){ - $scope = $rootScope.$new(); - controller = $controller('CreateRule0Ctrl', {$scope: $scope, toaster: toaster }); - }); - - describe("if the controller of CreateRule0Ctrl exists",function(){ - it('controller exists', function(){ - expect(controller).toBeDefined(); - }); - }) - - describe("if the $scope.click exists",function(){ - - it('$scope.click', function(){ - expect($scope.click).toBeDefined(); - }); - - it('should change location when setting it via click function', inject(function() { - var url = '/index'; - $scope.click(url); - spyOn($location, 'path').and.returnValue(url); - })); - - }) - - - }); - } -) http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/07f1a539/service/src/main/resources/public/tests/ut/specs/controllers/health-ctrl.spec.js ---------------------------------------------------------------------- diff --git a/service/src/main/resources/public/tests/ut/specs/controllers/health-ctrl.spec.js b/service/src/main/resources/public/tests/ut/specs/controllers/health-ctrl.spec.js deleted file mode 100644 index b35e40a..0000000 --- a/service/src/main/resources/public/tests/ut/specs/controllers/health-ctrl.spec.js +++ /dev/null @@ -1,73 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ -define(['require', 'angular', 'angularMocks', 'js/controllers/health-ctrl', 'echarts'], - function(require, angular, mocks, HealthCtrl) { - describe('Test /js/controllers/health-ctrl.js', function(){ - beforeEach(function(){ - module('app.controllers'); - module('app.services'); - }); - var $scope, $rootScope, $controller, $httpBackend, $config, $location, toaster, $timeout, $route; - - beforeEach(inject(function(_$rootScope_ , _$controller_, _$httpBackend_, _$config_, _$location_, _$timeout_){ - $rootScope = _$rootScope_; - $controller = _$controller_; - $httpBackend = _$httpBackend_; - $config = _$config_; - $location = _$location_; - $timeout = _$timeout_; - toaster = {}; - $route = {}; - })); - - beforeEach(function(){ - $scope = $rootScope.$new(); - controller = $controller('HealthCtrl', {$scope: $scope, $route: $route, toaster: toaster }); - }); - - describe("if the controller of HealthCtrl exists",function(){ - it('controller exists', function(){ - expect(controller).toBeDefined(); - }); - }) - - describe("check if parameters are available",function(){ - - it('$scope.value and $config.value should be right', function(){ - expect($config.uri.heatmap).toBeTruthy(); - }); - - }) - - describe("httpGet $config.uri.dbtree test",function(){ - beforeEach(function(){ - $httpBackend.when('GET', $config.uri.heatmap).respond([{"name":"unknown","dq":0.0,"metrics":[{"name":"mean","dq":4835.3,"dqfail":0,"timestamp":1470387389994,"metricType":"","assetName":null,"details":[]},{"name":"test1001","dq":1638.6,"dqfail":0,"timestamp":1470387312289,"metricType":"","assetName":null,"details":[]},{"name":"test_publish","dq":99.8,"dqfail":0,"timestamp":1463994766925,"metricType":"","assetName":null,"details":[]},{"name":"v","dq":99.8,"dqfail":0,"timestamp":1463994766925,"metricType":"","assetName":null,"details":[]}]},{"name":"Hadoop","dq":0.0,"metrics":[{"name":"movie_acc","dq":97.0,"dqfail":0,"timestamp":1470009600000,"metricType":"","assetName":null,"details":[]},{"name":"movie_acc_test2","dq":97.0,"dqfail":0,"timestamp":1470009600000,"metricType":"","assetName":null,"details":[]},{"name":"hadoop_accuracy_1","dq":99.053,"dqfail":0,"timestamp":1467356400000,"metricType":"","assetName":null,"details":[]}]},{"name":"Bullseye","dq":0.0,"metrics":[{"na me":"test_accuracy_1","dq":98.952,"dqfail":1,"timestamp":1467439200000,"metricType":"","assetName":null,"details":[]},{"name":"test_accuracy_2","dq":99.103,"dqfail":0,"timestamp":1467439200000,"metricType":"","assetName":null,"details":[]},{"name":"TotalCount_asset1","dq":5056215.0,"dqfail":0,"timestamp":1467439200000,"metricType":"","assetName":null,"details":[]},{"name":"TotalCount_asset2","dq":1.229703E7,"dqfail":0,"timestamp":1467356400000,"metricType":"","assetName":null,"details":[]},{"name":"aw","dq":5056215.0,"dqfail":0,"timestamp":1467439200000,"metricType":"Bollinger","assetName":null,"details":[]}]}]); - $httpBackend.flush(); - }); - - it('http response', function(){ - // expect($scope.dbList).toBeTruthy(); - }); - - afterEach(function() { - $httpBackend.verifyNoOutstandingExpectation(); - $httpBackend.verifyNoOutstandingRequest(); - }); - }) - - - }); - } -) http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/07f1a539/service/src/main/resources/public/tests/ut/specs/controllers/metrics-ctrl.spec.js ---------------------------------------------------------------------- diff --git a/service/src/main/resources/public/tests/ut/specs/controllers/metrics-ctrl.spec.js b/service/src/main/resources/public/tests/ut/specs/controllers/metrics-ctrl.spec.js deleted file mode 100644 index 0036101..0000000 --- a/service/src/main/resources/public/tests/ut/specs/controllers/metrics-ctrl.spec.js +++ /dev/null @@ -1,76 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ -define(['angular', 'angularMocks', 'js/controllers/metrics-ctrl'], - function(angular, mocks, MetricsCtrl) { - describe('Test /js/controllers/metrics-ctrl.js', function(){ - beforeEach(function(){ - module('app.controllers'); - module('app.services'); - }); - var $rootScope, $controller, $httpBackend, $config, $filter, $routeParams, $timeout, $compile, $route; - beforeEach(inject(function(_$rootScope_, _$controller_, _$httpBackend_, _$config_, _$filter_, _$timeout_, _$compile_){ - $rootScope = _$rootScope_; - $controller = _$controller_; - $httpBackend = _$httpBackend_; - $config = _$config_; - $filter = _$filter_; - $routeParams = {}; - // $routeParams.siteId = 'abc'; - $timeout = _$timeout_; - $compile = _$compile_; - $route = {}; - })); - - describe("function test",function(){ - var $scope; - - beforeEach(function(){ - $scope = $rootScope.$new(); - controller = $controller('MetricsCtrl', {$scope: $scope, $route: $route, $routeParams: $routeParams}); - }); - - it('controller exists', function(){ - // var controller = $controller('MetricsCtrl', {$scope: $scope, $routeParams: $routeParams}); - expect(controller).toBeDefined(); - }); - - it('$config.uri.dashboard', function(){ - expect($config.uri.dashboard).toBeTruthy(); - }); - - it('$scope.showBig works well', function(){ - expect($scope.showBig).toBeDefined(); - }); - - describe("http test",function(){ - beforeEach(function(){ - $httpBackend.when('GET', $config.uri.dashboard).respond({"age": 16,"name": "li"}); - $httpBackend.flush(); - }); - - it('http response', function(){ - expect($scope.dashboard.age).toBe(16); - }); - - afterEach(function() { - $httpBackend.verifyNoOutstandingExpectation(); - $httpBackend.verifyNoOutstandingRequest(); - }); - }) - - }) - }); - } -) http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/07f1a539/service/src/main/resources/public/tests/ut/specs/controllers/nav-ctrl_spec.js ---------------------------------------------------------------------- diff --git a/service/src/main/resources/public/tests/ut/specs/controllers/nav-ctrl_spec.js b/service/src/main/resources/public/tests/ut/specs/controllers/nav-ctrl_spec.js deleted file mode 100644 index b4549fb..0000000 --- a/service/src/main/resources/public/tests/ut/specs/controllers/nav-ctrl_spec.js +++ /dev/null @@ -1,47 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ -define(['angular', 'angularMocks', 'js/controllers/nav-ctrl'], - function(angular, mocks, navCtrl) { - describe('Test /js/controllers/nav-ctrl.js', function(){ - beforeEach(function(){ - module('app.controllers'); - module('app.services'); - }); - var $controller, $config, $httpBackend, $location; - - beforeEach(inject(function(_$controller_, _$config_, _$httpBackend_, _$location_){ - $controller = _$controller_; - $config = _$config_; - $httpBackend = _$httpBackend_; - $location = _$location_; - })); - - describe('$scope functions are set properly', function(){ - var $scope; - - beforeEach(function(){ - $scope = {}; - $controller('NavCtrl', {$scope:$scope}); - }) - - it('$scope.isActive is defined correctly', function(){ - $location.path('/home'); - expect($scope.isActive('/home')).toBeTruthy(); - }); - - }); - }); - } -); http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/07f1a539/service/src/main/resources/public/tests/ut/specs/controllers/rule-ctrl.spec.js ---------------------------------------------------------------------- diff --git a/service/src/main/resources/public/tests/ut/specs/controllers/rule-ctrl.spec.js b/service/src/main/resources/public/tests/ut/specs/controllers/rule-ctrl.spec.js deleted file mode 100644 index c5b0df8..0000000 --- a/service/src/main/resources/public/tests/ut/specs/controllers/rule-ctrl.spec.js +++ /dev/null @@ -1,57 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ -define(['angular', 'angularMocks', 'js/controllers/rule-ctrl'], - function(angular, mocks, RuleCtrl) { - describe('Test /js/controllers/rule-ctrl.js', function(){ - beforeEach(function(){ - module('app.controllers'); - module('app.services'); - }); - var $scope, $rootScope, $controller, $httpBackend, $config, $location, toaster, $timeout, $route; - - beforeEach(inject(function(_$rootScope_ , _$controller_, _$httpBackend_, _$config_, _$location_, _$timeout_){ - $rootScope = _$rootScope_; - $controller = _$controller_; - $httpBackend = _$httpBackend_; - $config = _$config_; - $location = _$location_; - $timeout = _$timeout_; - toaster = {}; - $route = {}; - })); - - beforeEach(function(){ - $scope = $rootScope.$new(); - controller = $controller('RuleCtrl', {$scope: $scope, $route: $route, toaster: toaster }); - }); - - describe("if the controller of RuleCtrl exists",function(){ - it('controller exists', function(){ - expect(controller).toBeDefined(); - }); - }) - - describe("check if createRowCollection",function(){ - - it('createRowCollection', function(){ - expect($scope.rowCollection).not.toEqual([]); - }); - - }) - - - }); - } -) http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/07f1a539/service/src/main/resources/public/tests/ut/specs/controllers/sidebar-ctrl_spec.js ---------------------------------------------------------------------- diff --git a/service/src/main/resources/public/tests/ut/specs/controllers/sidebar-ctrl_spec.js b/service/src/main/resources/public/tests/ut/specs/controllers/sidebar-ctrl_spec.js deleted file mode 100644 index 5b5a949..0000000 --- a/service/src/main/resources/public/tests/ut/specs/controllers/sidebar-ctrl_spec.js +++ /dev/null @@ -1,89 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ -define(['angular', 'angularMocks', 'js/controllers/sidebar-ctrl'], - function(angular, mocks, sidebarCtrl) { - describe('Test /js/controllers/sidebar-ctrl.js', function(){ - beforeEach(function(){ - module('app.controllers'); - module('app.services'); - }); - var $controller, $httpBackend, $config, $filter, $timeout, $compile; - beforeEach(inject(function(_$controller_, _$httpBackend_, _$config_, _$filter_, _$timeout_, _$compile_){ - $controller = _$controller_; - $httpBackend = _$httpBackend_; - $config = _$config_; - $filter = _$filter_; - $timeout = _$timeout_; - $compile = _$compile_; - })); - - describe("http unit test",function(){ - var $scope; - beforeEach(function(){ - $scope = {}; - $controller('SideBarCtrl', {$scope:$scope}); - }) - it('$scope.str works well', function(){ - // expect($scope.str).toEqual("hello"); - }); - it('url works well', function(){ - expect($config.uri.statistics).toBeTruthy(); - }); - it('function resizeSidebar() works well', function(){ - // expect($scope.resizeSidebar).toBeDefined(); - }); - describe("http get test",function(){ - beforeEach(function(){ - $httpBackend.when('GET', $config.uri.statistics).respond( - { - "assets": 16, - "metrics": 20, - "status":{ - "health": 16, - "warn": 3, - "invalid": 1 - } - } - ); - - $httpBackend.when('GET', $config.uri.briefmetrics).respond( - { - "assets": 16, - "metrics": 20, - "status":{ - "health": 16, - "warn": 3, - "invalid": 1 - } - } - ); - $httpBackend.flush(); - }); - - it("$scope.chartConfig is defined", function(){ - expect($scope.chartConfig).toBeDefined(); - }); - - afterEach(function() { - $httpBackend.verifyNoOutstandingExpectation(); - $httpBackend.verifyNoOutstandingRequest(); - }); - }) - - - }) - }); - } -) http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/07f1a539/service/src/main/resources/public/tests/ut/specs/controllers/viewrule-ctrl.spec.js ---------------------------------------------------------------------- diff --git a/service/src/main/resources/public/tests/ut/specs/controllers/viewrule-ctrl.spec.js b/service/src/main/resources/public/tests/ut/specs/controllers/viewrule-ctrl.spec.js deleted file mode 100644 index 1aa3c61..0000000 --- a/service/src/main/resources/public/tests/ut/specs/controllers/viewrule-ctrl.spec.js +++ /dev/null @@ -1,72 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ -define(['angular', 'angularMocks', 'js/controllers/viewrule-ctrl'], - function(angular, mocks, ViewRuleCtrl) { - describe('Test /js/controllers/viewrule-ctrl.js', function(){ - beforeEach(function(){ - module('app.controllers'); - module('app.services'); - }); - var $scope, $rootScope, $controller, $filter, $httpBackend, $config, $location, toaster, $timeout, $compile; - - beforeEach(inject(function(_$rootScope_ , _$controller_, _$filter_, _$httpBackend_, _$config_, _$location_, _$timeout_, _$compile_){ - $rootScope = _$rootScope_; - $controller = _$controller_; - $filter = _$filter_; - $httpBackend = _$httpBackend_; - $config = _$config_; - $location = _$location_; - $timeout = _$timeout_; - toaster = {}; - $compile = _$compile_; - })); - - beforeEach(function(){ - $scope = $rootScope.$new(); - controller = $controller('ViewRuleCtrl', {$scope: $scope, toaster: toaster}); - }); - - describe("if the controller of ViewRuleCtrl exists",function(){ - it('controller exists', function(){ - expect(controller).toBeDefined(); - }); - }) - - describe("check if parameters are available",function(){ - it('$scope.value and $config.value should be right', function(){ - expect($config.uri.rulemetric).toBeTruthy(); - }); - }) - - describe("httpGet $config.uri.rulemetric test",function(){ - beforeEach(function(){ - $httpBackend.when('GET', $config.uri.rulemetric).respond({"age": 16,"name": "li"}); - $httpBackend.flush(); - }); - - it('http response', function(){ - // expect($scope.dbList).toBeTruthy(); - }); - - afterEach(function() { - $httpBackend.verifyNoOutstandingExpectation(); - $httpBackend.verifyNoOutstandingRequest(); - }); - }) - - - }); - } -) http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/07f1a539/service/src/main/resources/public/tests/ut/specs/filters/strmap_spec.js ---------------------------------------------------------------------- diff --git a/service/src/main/resources/public/tests/ut/specs/filters/strmap_spec.js b/service/src/main/resources/public/tests/ut/specs/filters/strmap_spec.js deleted file mode 100644 index a2bbee0..0000000 --- a/service/src/main/resources/public/tests/ut/specs/filters/strmap_spec.js +++ /dev/null @@ -1,33 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ -define(['angular', 'angularMocks', 'js/filters/strmap'], - function(angular, mocks, filter) { - - describe('Test /js/filters/strmap.js', function() { - beforeEach(module('app.filters')); - - // Our first test!!!! - it('map correctly for index', mocks.inject(function($filter) { - // console.log($filter('strShorten')('1234567890123444444')); - var arr = ['Apple', 'Orange', 'Pale']; - expect($filter('strmap')(0, arr)).toEqual(arr[0]); - expect($filter('strmap')(3, arr)).toEqual(3); - - })); - - - }); - } -); http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/07f1a539/service/src/main/resources/public/tests/ut/specs/filters/strshorten_spec.js ---------------------------------------------------------------------- diff --git a/service/src/main/resources/public/tests/ut/specs/filters/strshorten_spec.js b/service/src/main/resources/public/tests/ut/specs/filters/strshorten_spec.js deleted file mode 100644 index e6ffa7d..0000000 --- a/service/src/main/resources/public/tests/ut/specs/filters/strshorten_spec.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ -define(['angular', 'angularMocks', 'js/filters/strshorten'], - function(angular, mocks, filter) { - - describe('Test /js/filters/strshorten.js', function() { - beforeEach(module('app.filters')); - // Here we register the function returned by the myFilter AMD module - // beforeEach(mocks.module(function($filterProvider) { - // $filterprovider.register('stringsFilter', filter); - // })); - - // Our first test!!!! - it('string should be shorten', mocks.inject(function($filter) { - // console.log($filter('strShorten')('1234567890123444444')); - expect($filter('strShorten')('abcde')).toEqual('abcde'); - expect($filter('strShorten')('1234567890123444444')).toEqual('123456789012...'); - })); - - // it('should be true', function(){ - // expect(1).not.toBeNull(); - // }); - - }); - } -); http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/07f1a539/service/src/main/resources/public/tests/ut/specs/services/services_spec.js ---------------------------------------------------------------------- diff --git a/service/src/main/resources/public/tests/ut/specs/services/services_spec.js b/service/src/main/resources/public/tests/ut/specs/services/services_spec.js deleted file mode 100644 index 8709dc1..0000000 --- a/service/src/main/resources/public/tests/ut/specs/services/services_spec.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ -define(['angular', 'angularMocks', 'js/services/services'], - function(angular, mocks, filter) { - - describe('Test /js/services/services.js', function() { - beforeEach(module('app.services')); - // Here we register the function returned by the myFilter AMD module - // beforeEach(mocks.module(function($filterProvider) { - // $filterprovider.register('stringsFilter', filter); - // })); - - // Our first test!!!! - it('$config uri is set', mocks.inject(function($config) { - // expect($config).not.toBeNull(); - expect(Object.getOwnPropertyNames($config.uri).length).toBeGreaterThan(0); - })); - - // it('should be true', function(){ - // expect(1).not.toBeNull(); - // }); - - }); - } -); http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/07f1a539/service/src/main/resources/public/tests/ut/test-main.js ---------------------------------------------------------------------- diff --git a/service/src/main/resources/public/tests/ut/test-main.js b/service/src/main/resources/public/tests/ut/test-main.js deleted file mode 100644 index ef3c9bb..0000000 --- a/service/src/main/resources/public/tests/ut/test-main.js +++ /dev/null @@ -1,97 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ -//for demo purpose -var allTestFiles = []; -var TEST_REGEXP = /(spec|test)\.js$/i; - -// Get a list of all the test files to include -Object.keys(window.__karma__.files).forEach(function(file) { - if (TEST_REGEXP.test(file)) { - // Normalize paths to RequireJS module names. - // If you require sub-dependencies of test files to be loaded as-is (requiring file extension) - // then do not normalize the paths - var normalizedTestModule = file.replace(/^\/base\/|\.js$/g, ''); - // var normalizedTestModule = file.replace(/^\/base\//, '').replace(/\.js$/, ''); - // console.log(normalizedTestModule); - allTestFiles.push(normalizedTestModule); - } -}); - -require.config({ - // Karma serves files under /base, which is the basePath from your config file - baseUrl: '/base', - - waitSeconds: 200, - // dynamically load all test files - deps: allTestFiles, - // dpes: ['C:/temp/Bark_UI/tests/ut/specs/my_first_spec'], - - - // we have to kickoff jasmine, as it is asynchronous - callback: window.__karma__.start, - paths: { - // 'domReady': '../bower_components/domReady/domReady', - 'angular': '/base/bower_components/angular/angular', - 'angularMocks': '/base/node_modules/angular-mocks/angular-mocks', - 'angularRoute': '/base/bower_components/angular-route/angular-route', - - 'ngAnimate': '/base/bower_components/angular-animate/angular-animate', - 'ngToaster': '/base/bower_components/AngularJS-Toaster/toaster', - - 'jquery': '/base/bower_components/jquery/dist/jquery', - 'bootstrap': '/base/bower_components/bootstrap/dist/js/bootstrap', - - - 'echarts': '/base/bower_components/echarts/dist/echarts', - }, - shim: { - 'angular': { - deps: ['jquery'], - exports: 'angular' - }, - // 'angularMocks': { - // exports: 'angularMocks', - // deps: ['angular'] - // }, - 'angularMocks': {deps: ['angular'], 'exports': 'angular.mock'}, - 'angularRoute': { - deps: ['angular'], - exports: 'angularRoute' - }, - 'ngSmartTable': { - deps: ['angular'], - exports: 'ngSmartTable' - }, - 'ngAnimate': { - deps: ['angular'], - exports: 'ngAnimate' - }, - 'ngToaster': { - deps: ['angular', 'ngAnimate'], - exports: 'ngToaster' - }, - - 'jquery': { - exports: 'jquery' - }, - 'bootstrap': { - exports: 'bootstrap', - deps: ['jquery'] - }, - 'echarts': { - exports: 'echarts' - } - } -});
