Committed by
Gerrit Code Review
[WEB-GUI Tests] Fixing UI unit tests
Change-Id: I6eb28a706e148da17f8b2d7d5f8e44821851462a
Showing
16 changed files
with
75 additions
and
53 deletions
| ... | @@ -37,7 +37,4 @@ Open Developer Tools in the captured Chrome browser, and reload the page. | ... | @@ -37,7 +37,4 @@ Open Developer Tools in the captured Chrome browser, and reload the page. |
| 37 | The debugger will break at the given point, allowing you to inspect context. | 37 | The debugger will break at the given point, allowing you to inspect context. |
| 38 | 38 | ||
| 39 | ---------------------------------------------------------------------- | 39 | ---------------------------------------------------------------------- |
| 40 | -FIXME | ||
| 41 | -===== | ||
| 42 | 40 | ||
| 43 | -Most of the skipped test were failing because of: `ReferenceError: userPrefs is not defined` | ... | ... |
| ... | @@ -45,9 +45,9 @@ describe('factory: fw/layer/flash.js', function () { | ... | @@ -45,9 +45,9 @@ describe('factory: fw/layer/flash.js', function () { |
| 45 | expect(flash).toBeDefined(); | 45 | expect(flash).toBeDefined(); |
| 46 | }); | 46 | }); |
| 47 | 47 | ||
| 48 | - xit('should define api functions', function () { | 48 | + it('should define api functions', function () { |
| 49 | expect(fs.areFunctions(flash, [ | 49 | expect(fs.areFunctions(flash, [ |
| 50 | - 'initFlash', 'flash', 'enable' | 50 | + 'initFlash', 'flash', 'enable', 'tempDiv' |
| 51 | ])).toBe(true); | 51 | ])).toBe(true); |
| 52 | }); | 52 | }); |
| 53 | 53 | ... | ... |
| ... | @@ -27,6 +27,8 @@ describe('factory: fw/layer/panel.js', function () { | ... | @@ -27,6 +27,8 @@ describe('factory: fw/layer/panel.js', function () { |
| 27 | $timeout = _$timeout_; | 27 | $timeout = _$timeout_; |
| 28 | fs = FnService; | 28 | fs = FnService; |
| 29 | ps = PanelService; | 29 | ps = PanelService; |
| 30 | + | ||
| 31 | + spyOn(fs, 'debugOn').and.returnValue(true); | ||
| 30 | d3Elem = d3.select('body').append('div').attr('id', 'floatpanels'); | 32 | d3Elem = d3.select('body').append('div').attr('id', 'floatpanels'); |
| 31 | ps.init(); | 33 | ps.init(); |
| 32 | })); | 34 | })); |
| ... | @@ -44,7 +46,7 @@ describe('factory: fw/layer/panel.js', function () { | ... | @@ -44,7 +46,7 @@ describe('factory: fw/layer/panel.js', function () { |
| 44 | expect(ps).toBeDefined(); | 46 | expect(ps).toBeDefined(); |
| 45 | }); | 47 | }); |
| 46 | 48 | ||
| 47 | - xit('should define api functions', function () { | 49 | + it('should define api functions', function () { |
| 48 | expect(fs.areFunctions(ps, [ | 50 | expect(fs.areFunctions(ps, [ |
| 49 | 'init', 'createPanel', 'destroyPanel' | 51 | 'init', 'createPanel', 'destroyPanel' |
| 50 | ])).toBeTruthy(); | 52 | ])).toBeTruthy(); |
| ... | @@ -62,7 +64,7 @@ describe('factory: fw/layer/panel.js', function () { | ... | @@ -62,7 +64,7 @@ describe('factory: fw/layer/panel.js', function () { |
| 62 | expect(floatPanelSelection().size()).toBe(0); | 64 | expect(floatPanelSelection().size()).toBe(0); |
| 63 | }); | 65 | }); |
| 64 | 66 | ||
| 65 | - xit('should create a default panel', function () { | 67 | + it('should create a default panel', function () { |
| 66 | spyOn($log, 'warn'); | 68 | spyOn($log, 'warn'); |
| 67 | spyOn($log, 'debug'); | 69 | spyOn($log, 'debug'); |
| 68 | var p = ps.createPanel('foo'); | 70 | var p = ps.createPanel('foo'); |
| ... | @@ -107,13 +109,13 @@ describe('factory: fw/layer/panel.js', function () { | ... | @@ -107,13 +109,13 @@ describe('factory: fw/layer/panel.js', function () { |
| 107 | expect(floatPanelSelection().size()).toBe(1); | 109 | expect(floatPanelSelection().size()).toBe(1); |
| 108 | }); | 110 | }); |
| 109 | 111 | ||
| 110 | - xit('should note when there is no panel to destroy', function () { | 112 | + it('should note when there is no panel to destroy', function () { |
| 111 | spyOn($log, 'debug'); | 113 | spyOn($log, 'debug'); |
| 112 | ps.destroyPanel('bar'); | 114 | ps.destroyPanel('bar'); |
| 113 | expect($log.debug).toHaveBeenCalledWith('no panel to destroy:', 'bar'); | 115 | expect($log.debug).toHaveBeenCalledWith('no panel to destroy:', 'bar'); |
| 114 | }); | 116 | }); |
| 115 | 117 | ||
| 116 | - xit('should destroy the panel', function () { | 118 | + it('should destroy the panel', function () { |
| 117 | spyOn($log, 'debug'); | 119 | spyOn($log, 'debug'); |
| 118 | var p = ps.createPanel('foo'); | 120 | var p = ps.createPanel('foo'); |
| 119 | expect(floatPanelSelection().size()).toBe(1); | 121 | expect(floatPanelSelection().size()).toBe(1); |
| ... | @@ -123,7 +125,7 @@ describe('factory: fw/layer/panel.js', function () { | ... | @@ -123,7 +125,7 @@ describe('factory: fw/layer/panel.js', function () { |
| 123 | expect(floatPanelSelection().size()).toBe(0); | 125 | expect(floatPanelSelection().size()).toBe(0); |
| 124 | }); | 126 | }); |
| 125 | 127 | ||
| 126 | - xit('should allow alternate settings to be given', function () { | 128 | + it('should allow alternate settings to be given', function () { |
| 127 | spyOn($log, 'debug'); | 129 | spyOn($log, 'debug'); |
| 128 | var p = ps.createPanel('foo', { width: 250, edge: 'left' }); | 130 | var p = ps.createPanel('foo', { width: 250, edge: 'left' }); |
| 129 | expect($log.debug).toHaveBeenCalledWith('creating panel:', 'foo', { | 131 | expect($log.debug).toHaveBeenCalledWith('creating panel:', 'foo', { | ... | ... |
| ... | @@ -18,9 +18,7 @@ | ... | @@ -18,9 +18,7 @@ |
| 18 | ONOS GUI -- Layer -- Veil Service - Unit Tests | 18 | ONOS GUI -- Layer -- Veil Service - Unit Tests |
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | -// FIXME ReferenceError: userPrefs is not defined | 21 | +describe('factory: fw/layer/veil.js', function () { |
| 22 | - | ||
| 23 | -xdescribe('factory: fw/layer/veil.js', function () { | ||
| 24 | var $log, $route, vs, fs, ks, gs; | 22 | var $log, $route, vs, fs, ks, gs; |
| 25 | 23 | ||
| 26 | beforeEach(module('onosLayer', 'onosNav', 'onosSvg', 'ngRoute', 'onosRemote')); | 24 | beforeEach(module('onosLayer', 'onosNav', 'onosSvg', 'ngRoute', 'onosRemote')); | ... | ... |
| ... | @@ -18,9 +18,7 @@ | ... | @@ -18,9 +18,7 @@ |
| 18 | ONOS GUI -- Masthead Controller - Unit Tests | 18 | ONOS GUI -- Masthead Controller - Unit Tests |
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | -// FIXME ReferenceError: userPrefs is not defined | 21 | +describe('Controller: MastCtrl', function () { |
| 22 | - | ||
| 23 | -xdescribe('Controller: MastCtrl', function () { | ||
| 24 | // instantiate the masthead module | 22 | // instantiate the masthead module |
| 25 | beforeEach(module('onosMast', 'onosUtil', 'onosLayer', 'onosWidget', 'onosSvg', 'onosRemote')); | 23 | beforeEach(module('onosMast', 'onosUtil', 'onosLayer', 'onosWidget', 'onosSvg', 'onosRemote')); |
| 26 | 24 | ||
| ... | @@ -29,7 +27,8 @@ xdescribe('Controller: MastCtrl', function () { | ... | @@ -29,7 +27,8 @@ xdescribe('Controller: MastCtrl', function () { |
| 29 | // we need an instance of the controller | 27 | // we need an instance of the controller |
| 30 | beforeEach(inject(function(_$log_, $controller, MastService, FnService) { | 28 | beforeEach(inject(function(_$log_, $controller, MastService, FnService) { |
| 31 | $log = _$log_; | 29 | $log = _$log_; |
| 32 | - ctrl = $controller('MastCtrl'); | 30 | + var $scope = {} |
| 31 | + ctrl = $controller('MastCtrl', {$scope: $scope}); | ||
| 33 | ms = MastService; | 32 | ms = MastService; |
| 34 | fs = FnService; | 33 | fs = FnService; |
| 35 | })); | 34 | })); | ... | ... |
| ... | @@ -17,7 +17,7 @@ | ... | @@ -17,7 +17,7 @@ |
| 17 | /* | 17 | /* |
| 18 | ONOS GUI -- Remote -- REST Service - Unit Tests | 18 | ONOS GUI -- Remote -- REST Service - Unit Tests |
| 19 | */ | 19 | */ |
| 20 | -xdescribe('factory: fw/remote/rest.js', function() { | 20 | +describe('factory: fw/remote/rest.js', function() { |
| 21 | var $log, $httpBackend, fs, rs, promise; | 21 | var $log, $httpBackend, fs, rs, promise; |
| 22 | 22 | ||
| 23 | beforeEach(module('onosUtil', 'onosRemote')); | 23 | beforeEach(module('onosUtil', 'onosRemote')); |
| ... | @@ -27,7 +27,10 @@ xdescribe('factory: fw/remote/rest.js', function() { | ... | @@ -27,7 +27,10 @@ xdescribe('factory: fw/remote/rest.js', function() { |
| 27 | return { | 27 | return { |
| 28 | protocol: function () { return 'http'; }, | 28 | protocol: function () { return 'http'; }, |
| 29 | host: function () { return 'foo'; }, | 29 | host: function () { return 'foo'; }, |
| 30 | - port: function () { return '80'; } | 30 | + port: function () { return '80'; }, |
| 31 | + search: function() { | ||
| 32 | + return {debug: 'true'}; | ||
| 33 | + } | ||
| 31 | }; | 34 | }; |
| 32 | }) | 35 | }) |
| 33 | })); | 36 | })); |
| ... | @@ -45,7 +48,8 @@ xdescribe('factory: fw/remote/rest.js', function() { | ... | @@ -45,7 +48,8 @@ xdescribe('factory: fw/remote/rest.js', function() { |
| 45 | 48 | ||
| 46 | it('should define api functions', function () { | 49 | it('should define api functions', function () { |
| 47 | expect(fs.areFunctions(rs, [ | 50 | expect(fs.areFunctions(rs, [ |
| 48 | - 'get' | 51 | + 'get', |
| 52 | + 'post' | ||
| 49 | ])).toBeTruthy(); | 53 | ])).toBeTruthy(); |
| 50 | }); | 54 | }); |
| 51 | 55 | ... | ... |
| ... | @@ -18,9 +18,7 @@ | ... | @@ -18,9 +18,7 @@ |
| 18 | ONOS GUI -- Remote -- General Functions - Unit Tests | 18 | ONOS GUI -- Remote -- General Functions - Unit Tests |
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | -// FIXME TypeError: $loc.search is not a function | 21 | +describe('factory: fw/remote/urlfn.js', function () { |
| 22 | - | ||
| 23 | -xdescribe('factory: fw/remote/urlfn.js', function () { | ||
| 24 | var $log, $loc, ufs, fs; | 22 | var $log, $loc, ufs, fs; |
| 25 | 23 | ||
| 26 | var protocol, host, port; | 24 | var protocol, host, port; |
| ... | @@ -32,7 +30,10 @@ xdescribe('factory: fw/remote/urlfn.js', function () { | ... | @@ -32,7 +30,10 @@ xdescribe('factory: fw/remote/urlfn.js', function () { |
| 32 | return { | 30 | return { |
| 33 | protocol: function () { return protocol; }, | 31 | protocol: function () { return protocol; }, |
| 34 | host: function () { return host; }, | 32 | host: function () { return host; }, |
| 35 | - port: function () { return port; } | 33 | + port: function () { return port; }, |
| 34 | + search: function() { | ||
| 35 | + return {debug: 'true'}; | ||
| 36 | + } | ||
| 36 | }; | 37 | }; |
| 37 | }) | 38 | }) |
| 38 | })); | 39 | })); | ... | ... |
| ... | @@ -18,9 +18,7 @@ | ... | @@ -18,9 +18,7 @@ |
| 18 | ONOS GUI -- Remote -- Web Socket Service - Unit Tests | 18 | ONOS GUI -- Remote -- Web Socket Service - Unit Tests |
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | -// FIXME TypeError: $loc.search is not a function | 21 | +describe('factory: fw/remote/websocket.js', function () { |
| 22 | - | ||
| 23 | -xdescribe('factory: fw/remote/websocket.js', function () { | ||
| 24 | var $log, fs, wss; | 22 | var $log, fs, wss; |
| 25 | 23 | ||
| 26 | var noop = function () {}, | 24 | var noop = function () {}, |
| ... | @@ -56,7 +54,10 @@ xdescribe('factory: fw/remote/websocket.js', function () { | ... | @@ -56,7 +54,10 @@ xdescribe('factory: fw/remote/websocket.js', function () { |
| 56 | return { | 54 | return { |
| 57 | protocol: function () { return 'http'; }, | 55 | protocol: function () { return 'http'; }, |
| 58 | host: function () { return 'foo'; }, | 56 | host: function () { return 'foo'; }, |
| 59 | - port: function () { return '80'; } | 57 | + port: function () { return '80'; }, |
| 58 | + search: function() { | ||
| 59 | + return {debug: 'true'}; | ||
| 60 | + } | ||
| 60 | }; | 61 | }; |
| 61 | }) | 62 | }) |
| 62 | })); | 63 | })); |
| ... | @@ -77,7 +78,9 @@ xdescribe('factory: fw/remote/websocket.js', function () { | ... | @@ -77,7 +78,9 @@ xdescribe('factory: fw/remote/websocket.js', function () { |
| 77 | expect(fs.areFunctions(wss, [ | 78 | expect(fs.areFunctions(wss, [ |
| 78 | 'resetSid', 'resetState', | 79 | 'resetSid', 'resetState', |
| 79 | 'createWebSocket', 'bindHandlers', 'unbindHandlers', | 80 | 'createWebSocket', 'bindHandlers', 'unbindHandlers', |
| 80 | - 'addOpenListener', 'removeOpenListener', 'sendEvent' | 81 | + 'addOpenListener', 'removeOpenListener', 'sendEvent', |
| 82 | + 'isConnected', 'loggedInUser', | ||
| 83 | + '_setVeilDelegate', '_setLoadingDelegate' | ||
| 81 | ])).toBeTruthy(); | 84 | ])).toBeTruthy(); |
| 82 | }); | 85 | }); |
| 83 | 86 | ... | ... |
| ... | @@ -18,7 +18,7 @@ | ... | @@ -18,7 +18,7 @@ |
| 18 | ONOS GUI -- Remote -- Web Socket Event Service - Unit Tests | 18 | ONOS GUI -- Remote -- Web Socket Event Service - Unit Tests |
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | -// NOTE WsEventService does not exist | 21 | +// NOTE WsEventService does not exist, it has been removed? |
| 22 | 22 | ||
| 23 | xdescribe('factory: fw/remote/wsevent.js', function () { | 23 | xdescribe('factory: fw/remote/wsevent.js', function () { |
| 24 | var $log, fs, wse; | 24 | var $log, fs, wse; | ... | ... |
| ... | @@ -35,9 +35,9 @@ describe('factory: fw/svg/geodata.js', function() { | ... | @@ -35,9 +35,9 @@ describe('factory: fw/svg/geodata.js', function() { |
| 35 | expect(gds).toBeDefined(); | 35 | expect(gds).toBeDefined(); |
| 36 | }); | 36 | }); |
| 37 | 37 | ||
| 38 | - xit('should define api functions', function () { | 38 | + it('should define api functions', function () { |
| 39 | expect(fs.areFunctions(gds, [ | 39 | expect(fs.areFunctions(gds, [ |
| 40 | - 'clearCache', 'fetchTopoData', 'createPathGenerator' | 40 | + 'clearCache', 'fetchTopoData', 'createPathGenerator', 'rescaleProjection' |
| 41 | ])).toBeTruthy(); | 41 | ])).toBeTruthy(); |
| 42 | }); | 42 | }); |
| 43 | 43 | ||
| ... | @@ -46,20 +46,20 @@ describe('factory: fw/svg/geodata.js', function() { | ... | @@ -46,20 +46,20 @@ describe('factory: fw/svg/geodata.js', function() { |
| 46 | expect(promise).toBeNull(); | 46 | expect(promise).toBeNull(); |
| 47 | }); | 47 | }); |
| 48 | 48 | ||
| 49 | - xit('should augment the id of a bundled map', function () { | 49 | + it('should augment the id of a bundled map', function () { |
| 50 | var id = '*foo'; | 50 | var id = '*foo'; |
| 51 | promise = gds.fetchTopoData(id); | 51 | promise = gds.fetchTopoData(id); |
| 52 | expect(promise.meta).toBeDefined(); | 52 | expect(promise.meta).toBeDefined(); |
| 53 | expect(promise.meta.id).toBe(id); | 53 | expect(promise.meta.id).toBe(id); |
| 54 | - expect(promise.meta.url).toBe('data/map/foo.json'); | 54 | + expect(promise.meta.url).toBe('data/map/foo.topojson'); |
| 55 | }); | 55 | }); |
| 56 | 56 | ||
| 57 | - xit('should treat an external id as the url itself', function () { | 57 | + it('should treat an external id as the url itself', function () { |
| 58 | var id = 'some/path/to/foo'; | 58 | var id = 'some/path/to/foo'; |
| 59 | promise = gds.fetchTopoData(id); | 59 | promise = gds.fetchTopoData(id); |
| 60 | expect(promise.meta).toBeDefined(); | 60 | expect(promise.meta).toBeDefined(); |
| 61 | expect(promise.meta.id).toBe(id); | 61 | expect(promise.meta.id).toBe(id); |
| 62 | - expect(promise.meta.url).toBe(id + '.json'); | 62 | + expect(promise.meta.url).toBe(id + '.topojson'); |
| 63 | }); | 63 | }); |
| 64 | 64 | ||
| 65 | it('should cache the returned objects', function () { | 65 | it('should cache the returned objects', function () { |
| ... | @@ -91,16 +91,16 @@ describe('factory: fw/svg/geodata.js', function() { | ... | @@ -91,16 +91,16 @@ describe('factory: fw/svg/geodata.js', function() { |
| 91 | }); | 91 | }); |
| 92 | 92 | ||
| 93 | 93 | ||
| 94 | - xit('should log a warning if data fails to load', function () { | 94 | + it('should log a warning if data fails to load', function () { |
| 95 | var id = 'foo'; | 95 | var id = 'foo'; |
| 96 | - $httpBackend.expectGET('foo.json').respond(404, 'Not found'); | 96 | + $httpBackend.expectGET('foo.topojson').respond(404, 'Not found'); |
| 97 | spyOn($log, 'warn'); | 97 | spyOn($log, 'warn'); |
| 98 | 98 | ||
| 99 | promise = gds.fetchTopoData(id); | 99 | promise = gds.fetchTopoData(id); |
| 100 | $httpBackend.flush(); | 100 | $httpBackend.flush(); |
| 101 | expect(promise.topodata).toBeUndefined(); | 101 | expect(promise.topodata).toBeUndefined(); |
| 102 | expect($log.warn) | 102 | expect($log.warn) |
| 103 | - .toHaveBeenCalledWith('Failed to retrieve map TopoJSON data: foo.json', | 103 | + .toHaveBeenCalledWith('Failed to retrieve map TopoJSON data: foo.topojson', |
| 104 | 404, 'Not found'); | 104 | 404, 'Not found'); |
| 105 | }); | 105 | }); |
| 106 | 106 | ||
| ... | @@ -125,8 +125,8 @@ describe('factory: fw/svg/geodata.js', function() { | ... | @@ -125,8 +125,8 @@ describe('factory: fw/svg/geodata.js', function() { |
| 125 | return simpleTopology({type: "LineString", arcs: [1, 2]}); | 125 | return simpleTopology({type: "LineString", arcs: [1, 2]}); |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | - xit('should use default settings if none are supplied', function () { | 128 | + it('should use default settings if none are supplied', function () { |
| 129 | - var gen = gds.createPathGenerator(simpleLineStringTopo()); | 129 | + var gen = gds.createPathGenerator(simpleLineStringTopo(), {adjustScale: true}); |
| 130 | expect(gen.settings.objectTag).toBe('states'); | 130 | expect(gen.settings.objectTag).toBe('states'); |
| 131 | expect(gen.settings.logicalSize).toBe(1000); | 131 | expect(gen.settings.logicalSize).toBe(1000); |
| 132 | expect(gen.settings.mapFillScale).toBe(.95); | 132 | expect(gen.settings.mapFillScale).toBe(.95); |
| ... | @@ -143,8 +143,8 @@ describe('factory: fw/svg/geodata.js', function() { | ... | @@ -143,8 +143,8 @@ describe('factory: fw/svg/geodata.js', function() { |
| 143 | expect(gen.settings.mapFillScale).toBe(.80); | 143 | expect(gen.settings.mapFillScale).toBe(.80); |
| 144 | }); | 144 | }); |
| 145 | 145 | ||
| 146 | - xit('should create transformed geodata, and a path generator', function () { | 146 | + it('should create transformed geodata, and a path generator', function () { |
| 147 | - var gen = gds.createPathGenerator(simpleLineStringTopo()); | 147 | + var gen = gds.createPathGenerator(simpleLineStringTopo(), {adjustScale: true}); |
| 148 | expect(fs.isO(gen.settings)).toBeTruthy(); | 148 | expect(fs.isO(gen.settings)).toBeTruthy(); |
| 149 | expect(fs.isO(gen.geodata)).toBeTruthy(); | 149 | expect(fs.isO(gen.geodata)).toBeTruthy(); |
| 150 | expect(fs.isF(gen.pathgen)).toBeTruthy(); | 150 | expect(fs.isF(gen.pathgen)).toBeTruthy(); | ... | ... |
| ... | @@ -25,10 +25,14 @@ describe('factory: fw/widget/chartBuilder.js', function () { | ... | @@ -25,10 +25,14 @@ describe('factory: fw/widget/chartBuilder.js', function () { |
| 25 | mockWss = { | 25 | mockWss = { |
| 26 | bindHandlers: function () {}, | 26 | bindHandlers: function () {}, |
| 27 | sendEvent: function () {}, | 27 | sendEvent: function () {}, |
| 28 | - unbindHandlers: function () {} | 28 | + unbindHandlers: function () {}, |
| 29 | + _setLoadingDelegate: function(){}, | ||
| 30 | + isConnected: function() { | ||
| 31 | + return true; | ||
| 32 | + } | ||
| 29 | }; | 33 | }; |
| 30 | 34 | ||
| 31 | - beforeEach(module('onosWidget', 'onosUtil', 'onosRemote', 'onosSvg')); | 35 | + beforeEach(module('onosWidget', 'onosUtil', 'onosRemote', 'onosSvg', 'onosLayer')); |
| 32 | 36 | ||
| 33 | beforeEach(function () { | 37 | beforeEach(function () { |
| 34 | module(function ($provide) { | 38 | module(function ($provide) { |
| ... | @@ -71,6 +75,7 @@ describe('factory: fw/widget/chartBuilder.js', function () { | ... | @@ -71,6 +75,7 @@ describe('factory: fw/widget/chartBuilder.js', function () { |
| 71 | expect(mockObj.scope.requestCallback).not.toBeDefined(); | 75 | expect(mockObj.scope.requestCallback).not.toBeDefined(); |
| 72 | cbs.buildChart(mockObj); | 76 | cbs.buildChart(mockObj); |
| 73 | expect(mockObj.scope.requestCallback).toBeDefined(); | 77 | expect(mockObj.scope.requestCallback).toBeDefined(); |
| 78 | + mockObj.scope.requestCallback(); | ||
| 74 | expect(mockWss.sendEvent).toHaveBeenCalled(); | 79 | expect(mockWss.sendEvent).toHaveBeenCalled(); |
| 75 | }); | 80 | }); |
| 76 | 81 | ||
| ... | @@ -88,4 +93,4 @@ describe('factory: fw/widget/chartBuilder.js', function () { | ... | @@ -88,4 +93,4 @@ describe('factory: fw/widget/chartBuilder.js', function () { |
| 88 | mockObj.scope.$destroy(); | 93 | mockObj.scope.$destroy(); |
| 89 | expect(mockWss.unbindHandlers).toHaveBeenCalled(); | 94 | expect(mockWss.unbindHandlers).toHaveBeenCalled(); |
| 90 | }); | 95 | }); |
| 91 | -} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 96 | +}); | ... | ... |
| ... | @@ -18,14 +18,18 @@ | ... | @@ -18,14 +18,18 @@ |
| 18 | ONOS GUI -- Widget -- Table Builder Service - Unit Tests | 18 | ONOS GUI -- Widget -- Table Builder Service - Unit Tests |
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | -xdescribe('factory: fw/widget/tableBuilder.js', function () { | 21 | +describe('factory: fw/widget/tableBuilder.js', function () { |
| 22 | var $log, $rootScope, fs, tbs, is; | 22 | var $log, $rootScope, fs, tbs, is; |
| 23 | 23 | ||
| 24 | var mockObj, | 24 | var mockObj, |
| 25 | mockWss = { | 25 | mockWss = { |
| 26 | bindHandlers: function () {}, | 26 | bindHandlers: function () {}, |
| 27 | sendEvent: function () {}, | 27 | sendEvent: function () {}, |
| 28 | - unbindHandlers: function () {} | 28 | + unbindHandlers: function () {}, |
| 29 | + _setLoadingDelegate: function(){}, | ||
| 30 | + isConnected: function() { | ||
| 31 | + return true; | ||
| 32 | + } | ||
| 29 | }; | 33 | }; |
| 30 | 34 | ||
| 31 | beforeEach(module('onosWidget', 'onosUtil', 'onosRemote', 'onosSvg', 'onosLayer')); | 35 | beforeEach(module('onosWidget', 'onosUtil', 'onosRemote', 'onosSvg', 'onosLayer')); | ... | ... |
| ... | @@ -26,10 +26,11 @@ describe('Controller: OnosCtrl', function () { | ... | @@ -26,10 +26,11 @@ describe('Controller: OnosCtrl', function () { |
| 26 | // we need an instance of the controller | 26 | // we need an instance of the controller |
| 27 | beforeEach(inject(function(_$log_, $controller) { | 27 | beforeEach(inject(function(_$log_, $controller) { |
| 28 | $log = _$log_; | 28 | $log = _$log_; |
| 29 | - ctrl = $controller('OnosCtrl'); | 29 | + var $scope = {}; |
| 30 | + ctrl = $controller('OnosCtrl', { $scope: $scope }); | ||
| 30 | })); | 31 | })); |
| 31 | 32 | ||
| 32 | - xit('should report version 1.2.0', function () { | 33 | + it('should report version 1.5.0', function () { |
| 33 | - expect(ctrl.version).toEqual('1.2.0'); | 34 | + expect(ctrl.version).toEqual('1.5.0'); |
| 34 | }); | 35 | }); |
| 35 | }); | 36 | }); |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -40,7 +40,10 @@ module.exports = function(config) { | ... | @@ -40,7 +40,10 @@ module.exports = function(config) { |
| 40 | 40 | ||
| 41 | // unit test code... | 41 | // unit test code... |
| 42 | 'app/*-spec.js', | 42 | 'app/*-spec.js', |
| 43 | - 'app/**/*-spec.js' | 43 | + 'app/**/*-spec.js', |
| 44 | + | ||
| 45 | + // server mock | ||
| 46 | + './server.mock.js' | ||
| 44 | ], | 47 | ], |
| 45 | 48 | ||
| 46 | 49 | ... | ... |
| ... | @@ -40,7 +40,10 @@ module.exports = function(config) { | ... | @@ -40,7 +40,10 @@ module.exports = function(config) { |
| 40 | 40 | ||
| 41 | // unit test code... | 41 | // unit test code... |
| 42 | 'app/*-spec.js', | 42 | 'app/*-spec.js', |
| 43 | - 'app/**/*-spec.js' | 43 | + 'app/**/*-spec.js', |
| 44 | + | ||
| 45 | + // server mock | ||
| 46 | + './server.mock.js' | ||
| 44 | ], | 47 | ], |
| 45 | 48 | ||
| 46 | 49 | ... | ... |
web/gui/src/main/webapp/tests/server.mock.js
0 → 100644
-
Please register or login to post a comment