mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Update GET tests for new functionality
This commit is contained in:
parent
56b729ac61
commit
3eae7cdf54
2 changed files with 48 additions and 22 deletions
|
@ -3,30 +3,34 @@ const createApiDocumentSchema = require('../common/create_api_document_schema');
|
|||
const createResourceObjectSchema = require('../common/create_resource_object_schema');
|
||||
const relationshipObjectSchema = require('../common/relationship_object_schema');
|
||||
|
||||
const indexPatternResourceObject = createResourceObjectSchema(
|
||||
Joi.object({
|
||||
title: Joi.string().required(),
|
||||
time_field_name: Joi.string(),
|
||||
interval_name: Joi.string(),
|
||||
fields: Joi.array().items(
|
||||
Joi.object({
|
||||
name: Joi.string().required(),
|
||||
count: Joi.number().integer(),
|
||||
scripted: Joi.boolean(),
|
||||
doc_values: Joi.boolean(),
|
||||
analyzed: Joi.boolean(),
|
||||
indexed: Joi.boolean(),
|
||||
type: Joi.string()
|
||||
})
|
||||
),
|
||||
field_format_map: Joi.object()
|
||||
}),
|
||||
Joi.object({
|
||||
template: relationshipObjectSchema
|
||||
})
|
||||
);
|
||||
|
||||
module.exports = {
|
||||
post: createApiDocumentSchema(
|
||||
createResourceObjectSchema(
|
||||
Joi.object({
|
||||
title: Joi.string().required(),
|
||||
time_field_name: Joi.string(),
|
||||
interval_name: Joi.string(),
|
||||
fields: Joi.array().items(
|
||||
Joi.object({
|
||||
name: Joi.string().required(),
|
||||
count: Joi.number().integer(),
|
||||
scripted: Joi.boolean(),
|
||||
doc_values: Joi.boolean(),
|
||||
analyzed: Joi.boolean(),
|
||||
indexed: Joi.boolean(),
|
||||
type: Joi.string()
|
||||
})
|
||||
),
|
||||
field_format_map: Joi.object()
|
||||
}),
|
||||
Joi.object({
|
||||
template: relationshipObjectSchema
|
||||
})
|
||||
Joi.alternatives().try(
|
||||
indexPatternResourceObject,
|
||||
Joi.array().items(indexPatternResourceObject)
|
||||
),
|
||||
Joi.array().items(
|
||||
createResourceObjectSchema(
|
||||
|
@ -34,7 +38,7 @@ module.exports = {
|
|||
template: Joi.string().required(),
|
||||
order: Joi.number().integer(),
|
||||
mappings: Joi.object()
|
||||
})
|
||||
}).unknown()
|
||||
)
|
||||
)
|
||||
),
|
||||
|
|
|
@ -58,6 +58,18 @@ define(function (require) {
|
|||
.then(function (res) {
|
||||
expect(res.body.data).to.be.an('array');
|
||||
expect(res.body.data.length).to.be(3);
|
||||
expect(res.body.included).to.not.be.ok();
|
||||
Joi.assert(res.body, indexPatternSchema.post);
|
||||
});
|
||||
});
|
||||
|
||||
bdd.it('should include related index templates if the include query string param is set', function () {
|
||||
return request.get('/kibana/index_patterns?include=template')
|
||||
.expect(200)
|
||||
.then(function (res) {
|
||||
expect(res.body.included).to.be.an('array');
|
||||
expect(res.body.included.length).to.be(3);
|
||||
Joi.assert(res.body, indexPatternSchema.post);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -83,6 +95,16 @@ define(function (require) {
|
|||
});
|
||||
});
|
||||
|
||||
bdd.it('should include related index template if the include query string param is set', function () {
|
||||
return request.get('/kibana/index_patterns/logstash-*?include=template')
|
||||
.expect(200)
|
||||
.then(function (res) {
|
||||
expect(res.body.data.attributes.title).to.be('logstash-*');
|
||||
expect(res.body.included[0].id).to.be('kibana-logstash-*');
|
||||
Joi.assert(res.body, indexPatternSchema.post);
|
||||
});
|
||||
});
|
||||
|
||||
bdd.it('should use snake_case in the response body', function () {
|
||||
return request.get('/kibana/index_patterns/logstash-*')
|
||||
.expect(200)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue