mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
add paramType tests, move instance checking there
This commit is contained in:
parent
dd55ff48b7
commit
1dd879cde4
6 changed files with 89 additions and 3 deletions
|
@ -137,6 +137,7 @@
|
|||
'specs/utils/registry/index',
|
||||
'specs/directives/filter_bar',
|
||||
'specs/components/agg_types/index',
|
||||
'specs/components/agg_types/param_types/index',
|
||||
'specs/components/vis/index',
|
||||
'specs/components/reflow_watcher',
|
||||
'specs/components/clipboard'
|
||||
|
|
|
@ -52,7 +52,6 @@ define(function (require) {
|
|||
|
||||
expect(aggParams).to.have.length(1);
|
||||
expect(aggParams[0]).to.be.a(FieldAggParam);
|
||||
expect(aggParams[0]).to.be.a(BaseAggParam);
|
||||
});
|
||||
|
||||
it('Uses the OptionedAggParam class for params of type "optioned"', function () {
|
||||
|
@ -65,7 +64,6 @@ define(function (require) {
|
|||
|
||||
expect(aggParams).to.have.length(1);
|
||||
expect(aggParams[0]).to.be.a(OptionedAggParam);
|
||||
expect(aggParams[0]).to.be.a(BaseAggParam);
|
||||
});
|
||||
|
||||
it('Uses the RegexAggParam class for params of type "regex"', function () {
|
||||
|
@ -78,7 +76,6 @@ define(function (require) {
|
|||
|
||||
expect(aggParams).to.have.length(1);
|
||||
expect(aggParams[0]).to.be.a(RegexAggParam);
|
||||
expect(aggParams[0]).to.be.a(BaseAggParam);
|
||||
});
|
||||
|
||||
it('Always converts the params to a BaseAggParam', function () {
|
||||
|
|
25
test/unit/specs/components/agg_types/param_types/_field.js
Normal file
25
test/unit/specs/components/agg_types/param_types/_field.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
define(function (require) {
|
||||
return ['Regex', function () {
|
||||
var _ = require('lodash');
|
||||
|
||||
var BaseAggParam;
|
||||
var FieldAggParam;
|
||||
|
||||
beforeEach(module('kibana'));
|
||||
// fetch out deps
|
||||
beforeEach(inject(function (Private) {
|
||||
BaseAggParam = Private(require('components/agg_types/param_types/base'));
|
||||
FieldAggParam = Private(require('components/agg_types/param_types/field'));
|
||||
}));
|
||||
|
||||
describe('constructor', function () {
|
||||
it('it is an instance of BaseAggParam', function () {
|
||||
var aggParam = new FieldAggParam({
|
||||
name: 'field'
|
||||
});
|
||||
|
||||
expect(aggParam).to.be.a(BaseAggParam);
|
||||
});
|
||||
});
|
||||
}];
|
||||
});
|
|
@ -0,0 +1,26 @@
|
|||
define(function (require) {
|
||||
return ['Regex', function () {
|
||||
var _ = require('lodash');
|
||||
|
||||
var BaseAggParam;
|
||||
var OptionedAggParam;
|
||||
|
||||
beforeEach(module('kibana'));
|
||||
// fetch out deps
|
||||
beforeEach(inject(function (Private) {
|
||||
BaseAggParam = Private(require('components/agg_types/param_types/base'));
|
||||
OptionedAggParam = Private(require('components/agg_types/param_types/optioned'));
|
||||
}));
|
||||
|
||||
describe('constructor', function () {
|
||||
it('it is an instance of BaseAggParam', function () {
|
||||
var aggParam = new OptionedAggParam({
|
||||
name: 'some_param',
|
||||
type: 'optioned'
|
||||
});
|
||||
|
||||
expect(aggParam).to.be.a(BaseAggParam);
|
||||
});
|
||||
});
|
||||
}];
|
||||
});
|
26
test/unit/specs/components/agg_types/param_types/_regex.js
Normal file
26
test/unit/specs/components/agg_types/param_types/_regex.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
define(function (require) {
|
||||
return ['Regex', function () {
|
||||
var _ = require('lodash');
|
||||
|
||||
var BaseAggParam;
|
||||
var RegexAggParam;
|
||||
|
||||
beforeEach(module('kibana'));
|
||||
// fetch out deps
|
||||
beforeEach(inject(function (Private) {
|
||||
BaseAggParam = Private(require('components/agg_types/param_types/base'));
|
||||
RegexAggParam = Private(require('components/agg_types/param_types/regex'));
|
||||
}));
|
||||
|
||||
describe('constructor', function () {
|
||||
it('it is an instance of BaseAggParam', function () {
|
||||
var aggParam = new RegexAggParam({
|
||||
name: 'some_param',
|
||||
type: 'regex'
|
||||
});
|
||||
|
||||
expect(aggParam).to.be.a(BaseAggParam);
|
||||
});
|
||||
});
|
||||
}];
|
||||
});
|
11
test/unit/specs/components/agg_types/param_types/index.js
Normal file
11
test/unit/specs/components/agg_types/param_types/index.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
define(function (require) {
|
||||
describe('ParamTypes', function () {
|
||||
var childSuites = [
|
||||
require('specs/components/agg_types/param_types/_field'),
|
||||
require('specs/components/agg_types/param_types/_optioned'),
|
||||
require('specs/components/agg_types/param_types/_regex')
|
||||
].forEach(function (s) {
|
||||
describe(s[0], s[1]);
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue