mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
add tests for the rison filters
This commit is contained in:
parent
c75ade4909
commit
5662396d78
2 changed files with 59 additions and 0 deletions
|
@ -71,6 +71,7 @@
|
|||
'specs/filters/field_type',
|
||||
'specs/filters/uriescape',
|
||||
'specs/filters/moment',
|
||||
'specs/filters/rison',
|
||||
'specs/filters/short_dots',
|
||||
'specs/filters/start_from',
|
||||
'specs/services/storage',
|
||||
|
|
58
test/unit/specs/filters/rison.js
Normal file
58
test/unit/specs/filters/rison.js
Normal file
|
@ -0,0 +1,58 @@
|
|||
define(function (require) {
|
||||
var angular = require('angular');
|
||||
|
||||
// Load the kibana app dependencies.
|
||||
require('angular-route');
|
||||
|
||||
// Load kibana and its applications
|
||||
require('index');
|
||||
require('apps/discover/index');
|
||||
|
||||
var rison;
|
||||
var risonDecode;
|
||||
|
||||
var init = function (expandable) {
|
||||
// Load the application
|
||||
module('kibana');
|
||||
|
||||
// Create the scope
|
||||
inject(function ($filter) {
|
||||
rison = $filter('rison');
|
||||
risonDecode = $filter('risonDecode');
|
||||
});
|
||||
};
|
||||
|
||||
describe('rison filters', function () {
|
||||
var testObj = {
|
||||
time: {
|
||||
from: 'now-15m',
|
||||
to: 'now'
|
||||
}
|
||||
};
|
||||
var testRison = '(time:(from:now-15m,to:now))';
|
||||
|
||||
beforeEach(function () {
|
||||
init();
|
||||
});
|
||||
|
||||
describe('rison', function () {
|
||||
it('should have the filter', function () {
|
||||
expect(rison).to.not.be(null);
|
||||
});
|
||||
|
||||
it('should rison encode data', function () {
|
||||
expect(rison(testObj)).to.be(testRison);
|
||||
});
|
||||
});
|
||||
|
||||
describe('risonDecode', function () {
|
||||
it('should have the filter', function () {
|
||||
expect(risonDecode).to.not.be(null);
|
||||
});
|
||||
|
||||
it('should decode rison data', function () {
|
||||
expect(risonDecode(testRison)).to.eql(testObj);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue