@spalger/kibana
Version:
Kibana is an open source (Apache Licensed), browser based analytics and search dashboard for Elasticsearch. Kibana is a snap to setup and start using. Kibana strives to be easy to get started with, while also being flexible and powerful, just like Elastic
35 lines (29 loc) • 1.1 kB
JavaScript
describe('_source formatting', function () {
var $ = require('jquery');
var _ = require('lodash');
var expect = require('expect.js');
var ngMock = require('ngMock');
var fieldFormats;
beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function (Private) {
fieldFormats = Private(require('ui/registry/field_formats'));
}));
describe('Source format', function () {
var indexPattern;
var hits;
var format;
var convertHtml;
beforeEach(ngMock.inject(function (Private) {
indexPattern = Private(require('fixtures/stubbed_logstash_index_pattern'));
hits = Private(require('fixtures/hits'));
format = fieldFormats.getInstance('_source');
convertHtml = format.getConverterFor('html');
}));
it('uses the _source, field, and hit to create a <dl>', function () {
var hit = _.first(hits);
var $dl = $(convertHtml(hit._source, indexPattern.fields.byName._source, hit));
expect($dl.is('dl')).to.be.ok();
expect($dl.find('dt')).to.have.length(_.keys(indexPattern.flattenHit(hit)).length);
});
});
});