mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
added tests for error handler constructor
This commit is contained in:
parent
abc8ac4d44
commit
59140ec386
2 changed files with 43 additions and 0 deletions
|
@ -100,6 +100,7 @@
|
|||
'specs/vislib/index',
|
||||
'specs/vislib/vis',
|
||||
'specs/vislib/handler',
|
||||
'specs/vislib/_error_handler',
|
||||
'specs/utils/diff_time_picker_vals',
|
||||
'specs/factories/events',
|
||||
'specs/index_patterns/_flatten_search_response',
|
||||
|
|
42
test/unit/specs/vislib/_error_handler.js
Normal file
42
test/unit/specs/vislib/_error_handler.js
Normal file
|
@ -0,0 +1,42 @@
|
|||
define(function (require) {
|
||||
|
||||
var angular = require('angular');
|
||||
angular.module('ErrorHandlerFactory', ['kibana']);
|
||||
|
||||
describe('VisLib ErrorHandler Test Suite', function () {
|
||||
var ErrorHandler;
|
||||
var errorHandler;
|
||||
|
||||
beforeEach(function () {
|
||||
module('ErrorHandlerFactory');
|
||||
});
|
||||
|
||||
beforeEach(function () {
|
||||
inject(function (Private) {
|
||||
ErrorHandler = Private(require('components/vislib/modules/_error_handler'));
|
||||
errorHandler = new ErrorHandler();
|
||||
});
|
||||
});
|
||||
|
||||
describe('validateWidthandHeight Method', function () {
|
||||
it('should throw an error when width and/or height is 0', function () {
|
||||
expect(function () {
|
||||
errorHandler.validateWidthandHeight(0, 200);
|
||||
}).to.throwError();
|
||||
expect(function () {
|
||||
errorHandler.validateWidthandHeight(200, 0);
|
||||
}).to.throwError();
|
||||
});
|
||||
|
||||
it('should throw an error when width and/or height is NaN', function () {
|
||||
expect(function () {
|
||||
errorHandler.validateWidthandHeight(null, 200);
|
||||
}).to.throwError();
|
||||
expect(function () {
|
||||
errorHandler.validateWidthandHeight(200, null);
|
||||
}).to.throwError();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue