Repository: incubator-zeppelin Updated Branches: refs/heads/master b929b34b5 -> eb29c6daa
Rename and improve existing zeppelin-web tests Harmonize the tests titles, and improve a couple of tests Author: Damien Corneau <[email protected]> Closes #289 from corneadoug/improve/webTestWording and squashes the following commits: c116fac [Damien Corneau] Rename and improve existing zeppelin-web tests Project: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/commit/eb29c6da Tree: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/tree/eb29c6da Diff: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/diff/eb29c6da Branch: refs/heads/master Commit: eb29c6daad2399293ddd17a6b78675134d338acc Parents: b929b34 Author: Damien Corneau <[email protected]> Authored: Tue Sep 8 11:59:55 2015 +0900 Committer: Damien Corneau <[email protected]> Committed: Fri Sep 11 12:46:02 2015 +0900 ---------------------------------------------------------------------- zeppelin-web/test/spec/controllers/main.js | 4 ++-- zeppelin-web/test/spec/controllers/notebook.js | 21 +++++++++++--------- zeppelin-web/test/spec/controllers/paragraph.js | 14 ++++++------- 3 files changed, 21 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/eb29c6da/zeppelin-web/test/spec/controllers/main.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/test/spec/controllers/main.js b/zeppelin-web/test/spec/controllers/main.js index 16785a9..7daa613 100644 --- a/zeppelin-web/test/spec/controllers/main.js +++ b/zeppelin-web/test/spec/controllers/main.js @@ -15,7 +15,7 @@ describe('Controller: MainCtrl', function() { }); })); - it('should attach a asIframe to the scope and the default value should be false', function() { + it('should attach "asIframe" to the scope and the default value should be false', function() { expect(scope.asIframe).toBeDefined(); expect(scope.asIframe).toEqual(false); }); @@ -24,7 +24,7 @@ describe('Controller: MainCtrl', function() { expect(scope.looknfeel).toEqual('default'); }); - it('should set asIframe flag to true when a controller broadcasts setIframe event', function() { + it('should set "asIframe" flag to true when a controller broadcasts setIframe event', function() { rootScope.$broadcast('setIframe', true); expect(scope.asIframe).toEqual(true); }); http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/eb29c6da/zeppelin-web/test/spec/controllers/notebook.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/test/spec/controllers/notebook.js b/zeppelin-web/test/spec/controllers/notebook.js index 313aa9d..5afa628 100644 --- a/zeppelin-web/test/spec/controllers/notebook.js +++ b/zeppelin-web/test/spec/controllers/notebook.js @@ -54,17 +54,17 @@ describe('Controller: NotebookCtrl', function() { expect(scope.editorToggled).toEqual(false); }); - it('should set showSetting to true when openSetting is called', function() { + it('should set "showSetting" to true when openSetting() is called', function() { scope.openSetting(); expect(scope.showSetting).toEqual(true); }); - it('should set showSetting to false when closeSetting is called', function() { + it('should set "showSetting" to false when closeSetting() is called', function() { scope.closeSetting(); expect(scope.showSetting).toEqual(false); }); - it('should return the correct value for getCronOptionNameFromValue', function() { + it('should return the correct value for getCronOptionNameFromValue()', function() { var none = scope.getCronOptionNameFromValue(); var oneMin = scope.getCronOptionNameFromValue('0 0/1 * * * ?'); var fiveMin = scope.getCronOptionNameFromValue('0 0/5 * * * ?'); @@ -84,20 +84,23 @@ describe('Controller: NotebookCtrl', function() { expect(oneDay).toEqual('1d'); }); - it('default value for isNoteDirty should be null', function() { + it('should have "isNoteDirty" as null by default', function() { expect(scope.isNoteDirty).toEqual(null); }); - it('calling startSaveTimer should first call killSaveTimer and start a new timer', function() { + it('should first call killSaveTimer() when calling startSaveTimer()', function() { expect(scope.saveTimer).toEqual(null); + spyOn(scope, 'killSaveTimer'); scope.startSaveTimer(); - expect(scope.isNoteDirty).toEqual(true); - expect(scope.saveTimer).toBeTruthy(); + expect(scope.killSaveTimer).toHaveBeenCalled(); }); - it('calling killSaveTimer should clear saveTimer flag', function() { + it('should set "saveTimer" when saveTimer() and killSaveTimer() are called', function() { + expect(scope.saveTimer).toEqual(null); + scope.startSaveTimer(); + expect(scope.saveTimer).toBeTruthy(); scope.killSaveTimer(); expect(scope.saveTimer).toEqual(null); }); -}); +}); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/eb29c6da/zeppelin-web/test/spec/controllers/paragraph.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/test/spec/controllers/paragraph.js b/zeppelin-web/test/spec/controllers/paragraph.js index abde0d9..25716c1 100644 --- a/zeppelin-web/test/spec/controllers/paragraph.js +++ b/zeppelin-web/test/spec/controllers/paragraph.js @@ -37,19 +37,19 @@ describe('Controller: ParagraphCtrl', function() { }); }); - it('getResultType should return "TEXT" when the type is unknown', function() { + it('should return "TEXT" by default when getResultType() is called with no parameter', function() { expect(scope.getResultType()).toEqual('TEXT'); }); - it('init value for colWidthOption should be false', function() { + it('should have this array of values for "colWidthOption"', function() { expect(scope.colWidthOption).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]); }); - it('init value for paragraphFocused should be false', function() { + it('should set default value of "paragraphFocused" as false', function() { expect(scope.paragraphFocused).toEqual(false); }); - it('loadTableData should be called when the result type is "TABLE" and the Graph mode should be "table"', function() { + it('should call loadTableData() and getGraphMode() should return "table" when the result type is "TABLE"', function() { scope.getResultType = jasmine.createSpy('getResultType spy').andCallFake(function() { return 'TABLE'; }); @@ -61,7 +61,7 @@ describe('Controller: ParagraphCtrl', function() { expect(scope.getGraphMode()).toEqual('table'); }); - it('renderHtml should be called when the result type is "HTML"', function() { + it('should call renderHtml() when the result type is "HTML"', function() { scope.getResultType = jasmine.createSpy('getResultType spy').andCallFake(function() { return 'HTML'; }); @@ -70,7 +70,7 @@ describe('Controller: ParagraphCtrl', function() { expect(scope.renderHtml).toHaveBeenCalled(); }); - it('renderAngular should be called when the result type is "ANGULAR"', function() { + it('should call renderAngular() when the result type is "ANGULAR"', function() { scope.getResultType = jasmine.createSpy('getResultType spy').andCallFake(function() { return 'ANGULAR'; }); @@ -79,4 +79,4 @@ describe('Controller: ParagraphCtrl', function() { expect(scope.renderAngular).toHaveBeenCalled(); }); -}); +}); \ No newline at end of file
