Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Bargar committed Jan 16, 2020
1 parent 34440a5 commit 44ac74f
Showing 1 changed file with 35 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,50 +26,48 @@ import { IndexPattern, indexPatterns } from '../../../kibana_services';

jest.mock('ui/new_platform');

// @ts-ignore
const indexPattern = {
fields: {
getByName: (name: string) => {
const fields: { [name: string]: {} } = {
_index: {
name: '_index',
type: 'string',
scripted: false,
filterable: true,
},
message: {
name: 'message',
type: 'string',
scripted: false,
filterable: false,
},
extension: {
name: 'extension',
type: 'string',
scripted: false,
filterable: true,
},
bytes: {
name: 'bytes',
type: 'number',
scripted: false,
filterable: true,
},
scripted: {
name: 'scripted',
type: 'number',
scripted: true,
filterable: false,
},
};
return fields[name];
fields: [
{
name: '_index',
type: 'string',
scripted: false,
filterable: true,
},
{
name: 'message',
type: 'string',
scripted: false,
filterable: false,
},
{
name: 'extension',
type: 'string',
scripted: false,
filterable: true,
},
},
{
name: 'bytes',
type: 'number',
scripted: false,
filterable: true,
},
{
name: 'scripted',
type: 'number',
scripted: true,
filterable: false,
},
],
metaFields: ['_index', '_score'],
flattenHit: undefined,
formatHit: jest.fn(hit => hit._source),
} as IndexPattern;

indexPattern.fields.getByName = (name: string) => {
return indexPattern.fields.find(field => field.name === name);
};

indexPattern.flattenHit = indexPatterns.flattenHitWrapper(indexPattern, indexPattern.metaFields);

describe('DocViewTable at Discover', () => {
Expand Down

0 comments on commit 44ac74f

Please sign in to comment.