mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
remove old tests
This commit is contained in:
parent
fa6ee7709c
commit
51eea3d083
3 changed files with 0 additions and 171 deletions
|
@ -1,45 +0,0 @@
|
|||
define(function (require) {
|
||||
var _ = require('lodash');
|
||||
var filterActions;
|
||||
var $rootScope;
|
||||
|
||||
describe('Filter Bar Actions', function () {
|
||||
|
||||
beforeEach(module('kibana'));
|
||||
|
||||
beforeEach(function () {
|
||||
inject(function (_$rootScope_, Private) {
|
||||
$rootScope = _$rootScope_;
|
||||
filterActions = Private(require('components/filter_bar/lib/filterActions'));
|
||||
});
|
||||
});
|
||||
|
||||
describe('apply', function () {
|
||||
it('should apply methods to scope', function () {
|
||||
var actions = filterActions($rootScope);
|
||||
|
||||
var methods = _.filter(_.keys(actions), function (method) {
|
||||
return method !== 'apply';
|
||||
});
|
||||
|
||||
filterActions($rootScope).apply();
|
||||
|
||||
_.each(methods, function (method) {
|
||||
expect($rootScope).to.have.property(method);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Filter Bar Actions', function () {
|
||||
var childSuites = [
|
||||
require('specs/components/filter_bar/_filterToggle'),
|
||||
require('specs/components/filter_bar/_filterInvert'),
|
||||
require('specs/components/filter_bar/_filterPin'),
|
||||
require('specs/components/filter_bar/_filterAdd'),
|
||||
require('specs/components/filter_bar/_filterRemove'),
|
||||
].forEach(function (s) {
|
||||
describe(s[0], s[1]);
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,55 +0,0 @@
|
|||
define(function (require) {
|
||||
var _ = require('lodash');
|
||||
var sinon = require('test_utils/auto_release_sinon');
|
||||
var globalStateStub = require('fixtures/global_state');
|
||||
var $rootScope, processGlobalFilters, filters;
|
||||
|
||||
describe('processGlobalFilters', function () {
|
||||
|
||||
beforeEach(function () {
|
||||
module('kibana', function ($provide) {
|
||||
$provide.service('globalState', function () { return globalStateStub; });
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(function () {
|
||||
inject(function (_$rootScope_, Private) {
|
||||
$rootScope = _$rootScope_;
|
||||
$rootScope.state = {};
|
||||
|
||||
processGlobalFilters = Private(require('components/filter_bar/lib/processGlobalFilters'));
|
||||
|
||||
filters = [
|
||||
{ meta: { index: 'logstash-*' }, query: { match: { '@tags': { query: 'foo' } } } },
|
||||
{ meta: { index: 'logstash-*' }, query: { match: { '@tags': { query: 'bar' } } } },
|
||||
{ meta: { pinned: true, index: 'logstash-*' }, query: { match: { '@tags': { query: 'fizz' } } } },
|
||||
{ meta: { pinned: true, index: 'logstash-*' }, query: { match: { '@tags': { query: 'buzz' } } } },
|
||||
];
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
delete globalStateStub.filters;
|
||||
});
|
||||
|
||||
it('should be an empty array if no filters are passed', function () {
|
||||
var processedFilters = processGlobalFilters();
|
||||
expect(_.isArray(processedFilters)).to.be(true);
|
||||
});
|
||||
|
||||
it('should remove pinned filters', function () {
|
||||
var processedFilters = processGlobalFilters(filters);
|
||||
expect(processedFilters).to.have.length(2);
|
||||
});
|
||||
|
||||
it('should append pinned filters from globalState', function () {
|
||||
globalStateStub.filters = [
|
||||
{ meta: { pinned: true, index: 'logstash-*' }, query: { match: { '@tags': { query: 'pinned' } } } },
|
||||
{ meta: { index: 'logstash-*' }, query: { match: { '@tags': { query: 'not pinned' } } } },
|
||||
];
|
||||
var processedFilters = processGlobalFilters(filters);
|
||||
expect(processedFilters).to.have.length(3);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
|
@ -1,71 +0,0 @@
|
|||
define(function (require) {
|
||||
var _ = require('lodash');
|
||||
var sinon = require('test_utils/auto_release_sinon');
|
||||
var saveFilterState = require('components/filter_bar/lib/saveFilterState');
|
||||
var globalStateStub = require('fixtures/global_state');
|
||||
var $rootScope;
|
||||
|
||||
describe('saveFilterState', function () {
|
||||
|
||||
beforeEach(module('kibana'));
|
||||
|
||||
beforeEach(function () {
|
||||
inject(function (_$rootScope_, _globalState_, Private) {
|
||||
$rootScope = _$rootScope_;
|
||||
$rootScope.state = {};
|
||||
});
|
||||
});
|
||||
|
||||
describe('module', function () {
|
||||
it('should export a function', function () {
|
||||
expect(saveFilterState).to.be.a('function');
|
||||
});
|
||||
});
|
||||
|
||||
describe('save state', function () {
|
||||
var saveState;
|
||||
var filters;
|
||||
|
||||
beforeEach(function () {
|
||||
saveState = saveFilterState($rootScope.state, globalStateStub.resetStub());
|
||||
filters = [
|
||||
{ meta: { index: 'logstash-*' }, query: { match: { '@tags': { query: 'foo' } } } },
|
||||
{ meta: { index: 'logstash-*' }, query: { match: { '@tags': { query: 'bar' } } } },
|
||||
];
|
||||
});
|
||||
|
||||
it('should save filters to state', function () {
|
||||
saveState(filters);
|
||||
expect($rootScope.state.filters).to.eql(filters);
|
||||
});
|
||||
|
||||
it('should save global filters', function () {
|
||||
expect(globalStateStub).not.to.have.property(filters);
|
||||
saveState(filters);
|
||||
expect(globalStateStub.filters).to.have.length(0);
|
||||
expect(globalStateStub.save.callCount).to.be(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('save global state', function () {
|
||||
var saveState;
|
||||
|
||||
beforeEach(function () {
|
||||
saveState = saveFilterState($rootScope.state, globalStateStub.resetStub());
|
||||
});
|
||||
|
||||
it('should should save pinned filters to global state', function () {
|
||||
var filters = [
|
||||
{ meta: { index: 'logstash-*' }, query: { match: { '@tags': { query: 'foo' } } } },
|
||||
{ meta: { index: 'logstash-*' }, query: { match: { '@tags': { query: 'bar' } } } },
|
||||
{ meta: { pinned: true, index: 'logstash-*' }, query: { match: { '@tags': { query: 'fizz' } } } },
|
||||
{ meta: { pinned: true, index: 'logstash-*' }, query: { match: { '@tags': { query: 'buzz' } } } },
|
||||
];
|
||||
|
||||
saveState(filters);
|
||||
expect($rootScope.state.filters).to.have.length(filters.length);
|
||||
expect(globalStateStub.filters).to.eql([ filters[2], filters[3] ]);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue