Simon Hunt

GUI -- Fixing broken unit tests.

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