mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
fix data view runtime fields api service key (#125430)
This commit is contained in:
parent
ddbb06032e
commit
d06dc147ea
6 changed files with 14 additions and 7 deletions
|
@ -3,7 +3,7 @@
|
|||
exports[`responseFormatter returns correct format 1`] = `
|
||||
Object {
|
||||
"body": Object {
|
||||
"SERVICE_KEY": Object {
|
||||
"data_view": Object {
|
||||
"title": "dataView",
|
||||
},
|
||||
"fields": Array [
|
||||
|
@ -18,12 +18,12 @@ Object {
|
|||
exports[`responseFormatter returns correct format for legacy 1`] = `
|
||||
Object {
|
||||
"body": Object {
|
||||
"SERVICE_KEY_LEGACY": Object {
|
||||
"title": "dataView",
|
||||
},
|
||||
"field": Object {
|
||||
"name": "field",
|
||||
},
|
||||
"index_pattern": Object {
|
||||
"title": "dataView",
|
||||
},
|
||||
},
|
||||
}
|
||||
`;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import { DataView, DataViewField } from 'src/plugins/data_views/common';
|
||||
import { SERVICE_KEY_LEGACY, SERVICE_KEY_TYPE } from '../../constants';
|
||||
import { SERVICE_KEY_LEGACY, SERVICE_KEY_TYPE, SERVICE_KEY } from '../../constants';
|
||||
|
||||
interface ResponseFormatterArgs {
|
||||
serviceKey: SERVICE_KEY_TYPE;
|
||||
|
@ -19,13 +19,13 @@ export const responseFormatter = ({ serviceKey, field, dataView }: ResponseForma
|
|||
const response = {
|
||||
body: {
|
||||
fields: [field.toSpec()],
|
||||
SERVICE_KEY: dataView.toSpec(),
|
||||
[SERVICE_KEY]: dataView.toSpec(),
|
||||
},
|
||||
};
|
||||
|
||||
const legacyResponse = {
|
||||
body: {
|
||||
SERVICE_KEY_LEGACY: dataView.toSpec(),
|
||||
[SERVICE_KEY_LEGACY]: dataView.toSpec(),
|
||||
field: field.toSpec(),
|
||||
},
|
||||
};
|
||||
|
|
|
@ -47,6 +47,8 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
});
|
||||
|
||||
expect(response2.status).to.be(200);
|
||||
expect(response2.body[config.serviceKey]).to.not.be.empty();
|
||||
|
||||
const field =
|
||||
config.serviceKey === 'index_pattern' ? response2.body.field : response2.body.fields[0];
|
||||
|
||||
|
@ -82,6 +84,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
);
|
||||
|
||||
expect(response2.status).to.be(200);
|
||||
expect(response2.body[config.serviceKey]).to.not.be.empty();
|
||||
|
||||
const field = response2.body[config.serviceKey].fields.runtimeBar;
|
||||
|
||||
|
|
|
@ -60,6 +60,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
config.serviceKey === 'index_pattern' ? response2.body.field : response2.body.fields[0];
|
||||
|
||||
expect(response2.status).to.be(200);
|
||||
expect(response2.body[config.serviceKey]).to.not.be.empty();
|
||||
expect(typeof field).to.be('object');
|
||||
expect(field.name).to.be('runtimeFoo');
|
||||
expect(field.type).to.be('string');
|
||||
|
|
|
@ -63,6 +63,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
});
|
||||
|
||||
expect(response2.status).to.be(200);
|
||||
expect(response2.body[config.serviceKey]).to.not.be.empty();
|
||||
|
||||
const response3 = await supertest.get(
|
||||
`${config.path}/${response1.body[config.serviceKey].id}/runtime_field/runtimeFoo`
|
||||
|
@ -122,6 +123,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
config.serviceKey === 'index_pattern' ? response2.body.field : response2.body.fields[0];
|
||||
|
||||
expect(response2.status).to.be(200);
|
||||
expect(response2.body[config.serviceKey]).to.not.be.empty();
|
||||
expect(typeof field.runtimeField).to.be('object');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -70,6 +70,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
config.serviceKey === 'index_pattern' ? response3.body.field : response3.body.fields[0];
|
||||
|
||||
expect(response3.status).to.be(200);
|
||||
expect(response3.body[config.serviceKey]).to.not.be.empty();
|
||||
expect(field.type).to.be('string');
|
||||
expect(field.runtimeField.type).to.be('keyword');
|
||||
expect(field.runtimeField.script.source).to.be("doc['something_new'].value");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue