Skip to content

Commit

Permalink
fix functiona test
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkime committed Jun 14, 2023
1 parent 8eb1711 commit 511098e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common';
import { INITIAL_REST_VERSION_INTERNAL } from '@kbn/data-views-plugin/server/constants';
import { FIELDS_FOR_WILDCARD_PATH } from '@kbn/data-views-plugin/common/constants';
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';

Expand All @@ -34,7 +35,7 @@ export default function ({ getService }: FtrProviderContext) {

it('can filter', async () => {
const a = await supertest
.put('/api/index_patterns/_fields_for_wildcard')
.put(FIELDS_FOR_WILDCARD_PATH)
.set(ELASTIC_HTTP_VERSION_HEADER, INITIAL_REST_VERSION_INTERNAL)
.query({ pattern: 'helloworld*' })
.send({ index_filter: { exists: { field: 'bye' } } });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common';
import { INITIAL_REST_VERSION_INTERNAL } from '@kbn/data-views-plugin/server/constants';
import { FIELDS_FOR_WILDCARD_PATH } from '@kbn/data-views-plugin/common/constants';
import expect from '@kbn/expect';
import { sortBy } from 'lodash';
import { FtrProviderContext } from '../../../ftr_provider_context';
Expand Down Expand Up @@ -84,7 +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')
.get(FIELDS_FOR_WILDCARD_PATH)
.set(ELASTIC_HTTP_VERSION_HEADER, INITIAL_REST_VERSION_INTERNAL)
.query({ pattern: 'basic_index' })
.expect(200, {
Expand All @@ -96,7 +97,7 @@ export default function ({ getService }: FtrProviderContext) {

it('returns a single field as requested', async () => {
await supertest
.get('/api/index_patterns/_fields_for_wildcard')
.get(FIELDS_FOR_WILDCARD_PATH)
.set(ELASTIC_HTTP_VERSION_HEADER, INITIAL_REST_VERSION_INTERNAL)
.query({ pattern: 'basic_index', fields: JSON.stringify(['bar']) })
.expect(200, {
Expand All @@ -107,7 +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')
.get(FIELDS_FOR_WILDCARD_PATH)
.set(ELASTIC_HTTP_VERSION_HEADER, INITIAL_REST_VERSION_INTERNAL)
.query({
pattern: 'basic_index',
Expand Down Expand Up @@ -200,7 +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')
.get(FIELDS_FOR_WILDCARD_PATH)
.set(ELASTIC_HTTP_VERSION_HEADER, INITIAL_REST_VERSION_INTERNAL)
.query({ pattern: 'bad_index,basic_index' })
.expect(200, {
Expand All @@ -211,15 +212,15 @@ export default function ({ getService }: FtrProviderContext) {

it('returns 404 when neither exists', async () => {
await supertest
.get('/api/index_patterns/_fields_for_wildcard')
.get(FIELDS_FOR_WILDCARD_PATH)
.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')
.get(FIELDS_FOR_WILDCARD_PATH)
.set(ELASTIC_HTTP_VERSION_HEADER, INITIAL_REST_VERSION_INTERNAL)
.query({
pattern: 'bad_index',
Expand Down

0 comments on commit 511098e

Please sign in to comment.