Simon Hunt

GUI -- Fixing broken unit tests.

Change-Id: Ibb5dd090e300ae3f7046144c825d8f5d53e7e24e
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
35 35
36 // view IDs.. note the first view listed is loaded at startup 36 // view IDs.. note the first view listed is loaded at startup
37 var viewIds = [ 37 var viewIds = [
38 - // TODO: inject view IDs server side
39 // {INJECTED-VIEW-IDS-START} 38 // {INJECTED-VIEW-IDS-START}
40 'sample', 39 'sample',
41 'topo', 40 'topo',
......
...@@ -18,9 +18,6 @@ ...@@ -18,9 +18,6 @@
18 ONOS GUI -- Device Controller - Unit Tests 18 ONOS GUI -- Device Controller - Unit Tests
19 */ 19 */
20 describe('Controller: OvDeviceCtrl', function () { 20 describe('Controller: OvDeviceCtrl', function () {
21 - // instantiate the Device module
22 - beforeEach(module('ovDevice', 'onosRemote'));
23 -
24 var $log, $scope, $controller, ctrl, $mockHttp; 21 var $log, $scope, $controller, ctrl, $mockHttp;
25 22
26 var fakeData = { 23 var fakeData = {
...@@ -40,6 +37,9 @@ describe('Controller: OvDeviceCtrl', function () { ...@@ -40,6 +37,9 @@ describe('Controller: OvDeviceCtrl', function () {
40 }] 37 }]
41 }; 38 };
42 39
40 + // instantiate the Device module
41 + beforeEach(module('ovDevice', 'onosRemote', 'onosLayer', 'onosSvg', 'ngRoute'));
42 +
43 beforeEach(inject(function(_$log_, $rootScope, _$controller_, $httpBackend) { 43 beforeEach(inject(function(_$log_, $rootScope, _$controller_, $httpBackend) {
44 $log = _$log_; 44 $log = _$log_;
45 $scope = $rootScope.$new(); 45 $scope = $rootScope.$new();
...@@ -48,7 +48,6 @@ describe('Controller: OvDeviceCtrl', function () { ...@@ -48,7 +48,6 @@ describe('Controller: OvDeviceCtrl', function () {
48 })); 48 }));
49 49
50 beforeEach(function() { 50 beforeEach(function() {
51 - $scope = {};
52 ctrl = $controller('OvDeviceCtrl', { $scope: $scope }); 51 ctrl = $controller('OvDeviceCtrl', { $scope: $scope });
53 $mockHttp.whenGET(/\/device$/).respond(fakeData); 52 $mockHttp.whenGET(/\/device$/).respond(fakeData);
54 }); 53 });
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
20 describe('factory: view/topo/topoEvent.js', function() { 20 describe('factory: view/topo/topoEvent.js', function() {
21 var $log, fs, tes; 21 var $log, fs, tes;
22 22
23 - beforeEach(module('ovTopo', 'onosUtil', 'onosLayer')); 23 + beforeEach(module('ovTopo', 'onosUtil', 'onosLayer', 'ngRoute'));
24 24
25 beforeEach(inject(function (_$log_, FnService, TopoEventService) { 25 beforeEach(inject(function (_$log_, FnService, TopoEventService) {
26 $log = _$log_; 26 $log = _$log_;
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
20 describe('factory: view/topo/topoForce.js', function() { 20 describe('factory: view/topo/topoForce.js', function() {
21 var $log, fs, tfs; 21 var $log, fs, tfs;
22 22
23 - beforeEach(module('ovTopo', 'onosUtil', 'onosLayer')); 23 + beforeEach(module('ovTopo', 'onosUtil', 'onosLayer', 'ngRoute'));
24 24
25 beforeEach(inject(function (_$log_, FnService, TopoForceService) { 25 beforeEach(inject(function (_$log_, FnService, TopoForceService) {
26 $log = _$log_; 26 $log = _$log_;
...@@ -36,7 +36,8 @@ describe('factory: view/topo/topoForce.js', function() { ...@@ -36,7 +36,8 @@ describe('factory: view/topo/topoForce.js', function() {
36 expect(fs.areFunctions(tfs, [ 36 expect(fs.areFunctions(tfs, [
37 'initForce', 'newDim', 'destroyForce', 37 'initForce', 'newDim', 'destroyForce',
38 38
39 - 'updateDeviceColors', 'toggleHosts', 'toggleOffline', 39 + 'updateDeviceColors', 'toggleHosts',
40 + 'togglePorts', 'toggleOffline',
40 'cycleDeviceLabels', 'unpin', 'showMastership', 41 'cycleDeviceLabels', 'unpin', 'showMastership',
41 42
42 'addDevice', 'updateDevice', 'removeDevice', 43 'addDevice', 'updateDevice', 'removeDevice',
......
...@@ -138,8 +138,10 @@ describe('factory: view/topo/topoModel.js', function() { ...@@ -138,8 +138,10 @@ describe('factory: view/topo/topoModel.js', function() {
138 compare: function (actual, xy1, xy2) { 138 compare: function (actual, xy1, xy2) {
139 var result = {}; 139 var result = {};
140 140
141 - result.pass = (actual.x1 === xy1[0]) && (actual.y1 === xy1[1]) && 141 + result.pass = (actual.source.x === xy1[0]) &&
142 - (actual.x2 === xy2[0]) && (actual.y2 === xy2[1]); 142 + (actual.source.y === xy1[1]) &&
143 + (actual.target.x === xy2[0]) &&
144 + (actual.target.y === xy2[1]);
143 145
144 if (result.pass) { 146 if (result.pass) {
145 // for negation with ".not" 147 // for negation with ".not"
......