kibana-123
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
39 lines (32 loc) • 1.28 kB
JavaScript
import schemaProvider from '../schema';
import expect from 'expect.js';
import Joi from 'joi';
describe('Config schema', function () {
let schema;
beforeEach(() => schema = schemaProvider());
function validate(data, options) {
return Joi.validate(data, schema, options);
}
describe('server', function () {
describe('basePath', function () {
it('accepts empty strings', function () {
const { error } = validate({ server: { basePath: '' }});
expect(error == null).to.be.ok();
});
it('accepts strings with leading slashes', function () {
const { error } = validate({ server: { basePath: '/path' }});
expect(error == null).to.be.ok();
});
it('rejects strings with trailing slashes', function () {
const { error } = validate({ server: { basePath: '/path/' }});
expect(error).to.have.property('details');
expect(error.details[0]).to.have.property('path', 'server.basePath');
});
it('rejects strings without leading slashes', function () {
const { error } = validate({ server: { basePath: 'path' }});
expect(error).to.have.property('details');
expect(error.details[0]).to.have.property('path', 'server.basePath');
});
});
});
});