Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mbondyra committed Oct 26, 2023
1 parent 8b4738e commit e149826
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion x-pack/plugins/lens/public/mocks/index.ts
Expand Up @@ -6,6 +6,7 @@
*/

import { DragContextState, DragContextValue } from '@kbn/dom-drag-drop';
import { DatatableColumnType } from '@kbn/expressions-plugin/common';
import { createMockDataViewsState } from '../data_views_service/mocks';
import { FramePublicAPI, FrameDatasourceAPI } from '../types';
export { mockDataPlugin } from './data_plugin_mock';
Expand Down Expand Up @@ -94,7 +95,9 @@ export function generateActiveData(
const columns = Object.keys(rows[0]).map((columnId) => ({
id: columnId,
name: columnId,
meta: { type: 'number' as const },
meta: {
type: typeof rows[0][columnId]! as DatatableColumnType,
},
}));
memo[id] = {
type: 'datatable' as const,
Expand Down
Expand Up @@ -275,6 +275,7 @@ describe('metric visualization', () => {
mockDatasource.publicAPIMock.getMaxPossibleNumValues.mockReturnValue(maxPossibleNumValues);
mockDatasource.publicAPIMock.getOperationForColumnId.mockReturnValue({
isStaticValue: false,
dataType: 'number',
} as OperationDescriptor);

datasourceLayers = {
Expand Down Expand Up @@ -623,7 +624,7 @@ describe('metric visualization', () => {
it('always applies max function to static max dimensions', () => {
(
datasourceLayers.first as jest.Mocked<DatasourcePublicAPI>
).getOperationForColumnId.mockReturnValueOnce({
).getOperationForColumnId.mockReturnValue({
isStaticValue: true,
} as OperationDescriptor);

Expand Down Expand Up @@ -655,6 +656,9 @@ describe('metric visualization', () => {
"type": "function",
}
`);
(
datasourceLayers.first as jest.Mocked<DatasourcePublicAPI>
).getOperationForColumnId.mockClear();
});
});

Expand Down

0 comments on commit e149826

Please sign in to comment.