Skip to content

Commit

Permalink
initialising saved search in beforeEach
Browse files Browse the repository at this point in the history
  • Loading branch information
jgowdyelastic committed Jul 15, 2020
1 parent 280562d commit 41db653
Showing 1 changed file with 40 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,48 +10,51 @@ import { SavedSearchSavedObject } from '../../../../../common/types/kibana';
import { createSearchItems } from './new_job_utils';

describe('createSearchItems', () => {
const savedSearch = ({
client: {
http: {
basePath: {
basePath: '/abc',
serverBasePath: '/abc',
},
anonymousPaths: {},
},
batchQueue: [],
},
attributes: {
title: 'not test',
description: '',
hits: 0,
columns: ['_source'],
sort: [],
version: 1,
kibanaSavedObjectMeta: {
searchSourceJSON: '',
},
},
_version: 'WzI0OSw0XQ==',
id: '4b9b1010-c678-11ea-b6e6-e942978fa29c',
type: 'search',
migrationVersion: {
search: '7.4.0',
},
references: [
{
name: 'kibanaSavedObjectMeta.searchSourceJSON.index',
type: 'index-pattern',
id: '7e252840-bd27-11ea-8a6c-75d1a0bd08ab',
},
],
} as unknown) as SavedSearchSavedObject;

const kibanaConfig = {} as IUiSettingsClient;
const indexPattern = ({
fields: [],
} as unknown) as IIndexPattern;

let savedSearch = ({} as unknown) as SavedSearchSavedObject;
beforeEach(() => {
savedSearch = ({
client: {
http: {
basePath: {
basePath: '/abc',
serverBasePath: '/abc',
},
anonymousPaths: {},
},
batchQueue: [],
},
attributes: {
title: 'not test',
description: '',
hits: 0,
columns: ['_source'],
sort: [],
version: 1,
kibanaSavedObjectMeta: {
searchSourceJSON: '',
},
},
_version: 'WzI0OSw0XQ==',
id: '4b9b1010-c678-11ea-b6e6-e942978fa29c',
type: 'search',
migrationVersion: {
search: '7.4.0',
},
references: [
{
name: 'kibanaSavedObjectMeta.searchSourceJSON.index',
type: 'index-pattern',
id: '7e252840-bd27-11ea-8a6c-75d1a0bd08ab',
},
],
} as unknown) as SavedSearchSavedObject;
});

test('should match index pattern', () => {
const resp = createSearchItems(kibanaConfig, indexPattern, null);
expect(resp).toStrictEqual({
Expand Down

0 comments on commit 41db653

Please sign in to comment.