Skip to content

Commit

Permalink
🐛 Add missing function
Browse files Browse the repository at this point in the history
  • Loading branch information
dej611 committed Aug 17, 2023
1 parent c011c98 commit 9fc470d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions x-pack/plugins/lens/public/datasources/form_based/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,3 +232,15 @@ export function createMockedDragDropContext(): jest.Mocked<DragContextState> {
registerDropTarget: jest.fn(),
};
}

export const createMockedIndexPatternWithAdditionalFields = (
newFields: IndexPatternField[]
): IndexPattern => {
const { fields, ...otherIndexPatternProps } = createMockedIndexPattern();
const completeFields = fields.concat(newFields);
return {
...otherIndexPatternProps,
fields: completeFields,
getFieldByName: getFieldByNameFactory(completeFields),
};
};

0 comments on commit 9fc470d

Please sign in to comment.