add paramType tests, move instance checking there

This commit is contained in:
Joe Fleming 2014-10-13 16:48:46 -07:00
parent dd55ff48b7
commit 1dd879cde4
6 changed files with 89 additions and 3 deletions

View file

@ -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'

View file

@ -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 () {

View 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);
});
});
}];
});

View file

@ -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);
});
});
}];
});

View 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);
});
});
}];
});

View 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]);
});
});
});