Skip to content

Commit

Permalink
fix functional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkime committed Jun 12, 2023
1 parent 6b282b4 commit 83dc781
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* Side Public License, v 1.
*/

import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common';
import { INITIAL_REST_VERSION_INTERNAL } from '@kbn/data-views-plugin/server/constants';
import expect from '@kbn/expect';
import { sortBy } from 'lodash';
import { FtrProviderContext } from '../../../ftr_provider_context';
Expand Down Expand Up @@ -83,6 +85,7 @@ export default function ({ getService }: FtrProviderContext) {
it('returns a flattened version of the fields in es', async () => {
await supertest
.get('/api/index_patterns/_fields_for_wildcard')
.set(ELASTIC_HTTP_VERSION_HEADER, INITIAL_REST_VERSION_INTERNAL)
.query({ pattern: 'basic_index' })
.expect(200, {
fields: testFields,
Expand All @@ -94,6 +97,7 @@ export default function ({ getService }: FtrProviderContext) {
it('returns a single field as requested', async () => {
await supertest
.get('/api/index_patterns/_fields_for_wildcard')
.set(ELASTIC_HTTP_VERSION_HEADER, INITIAL_REST_VERSION_INTERNAL)
.query({ pattern: 'basic_index', fields: JSON.stringify(['bar']) })
.expect(200, {
fields: [testFields[0]],
Expand All @@ -104,6 +108,7 @@ export default function ({ getService }: FtrProviderContext) {
it('always returns a field for all passed meta fields', async () => {
await supertest
.get('/api/index_patterns/_fields_for_wildcard')
.set(ELASTIC_HTTP_VERSION_HEADER, INITIAL_REST_VERSION_INTERNAL)
.query({
pattern: 'basic_index',
meta_fields: JSON.stringify(['_id', '_source', 'crazy_meta_field']),
Expand Down Expand Up @@ -196,6 +201,7 @@ export default function ({ getService }: FtrProviderContext) {
it('returns fields when one pattern exists and the other does not', async () => {
await supertest
.get('/api/index_patterns/_fields_for_wildcard')
.set(ELASTIC_HTTP_VERSION_HEADER, INITIAL_REST_VERSION_INTERNAL)
.query({ pattern: 'bad_index,basic_index' })
.expect(200, {
fields: testFields,
Expand All @@ -206,13 +212,15 @@ export default function ({ getService }: FtrProviderContext) {
it('returns 404 when neither exists', async () => {
await supertest
.get('/api/index_patterns/_fields_for_wildcard')
.set(ELASTIC_HTTP_VERSION_HEADER, INITIAL_REST_VERSION_INTERNAL)
.query({ pattern: 'bad_index,bad_index_2' })
.expect(404);
});

it('returns 404 when no patterns exist', async () => {
await supertest
.get('/api/index_patterns/_fields_for_wildcard')
.set(ELASTIC_HTTP_VERSION_HEADER, INITIAL_REST_VERSION_INTERNAL)
.query({
pattern: 'bad_index',
})
Expand Down

0 comments on commit 83dc781

Please sign in to comment.