Skip to content

Commit

Permalink
appeasing lint pt2
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Sebastian <[email protected]>
  • Loading branch information
paulstn committed Mar 11, 2024
1 parent 23e6f2f commit 06f69a9
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 13 deletions.
2 changes: 1 addition & 1 deletion common/constants/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,4 +266,4 @@ export const DEFAULT_START_TIME = 'now-15m';
export const QUERY_ASSIST_START_TIME = 'now-40y';
export const QUERY_ASSIST_END_TIME = 'now';

export const TIMESTAMP_DATETIME_TYPES = ['date', 'date_nanos']
export const TIMESTAMP_DATETIME_TYPES = ['date', 'date_nanos'];
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,59 @@ exports[`Datagrid component Renders data grid component 1`] = `
"unselectedFields": Array [],
}
}
http={[MockFunction]}
http={
Object {
"addLoadingCountSource": [MockFunction],
"anonymousPaths": Object {
"isAnonymous": [MockFunction],
"register": [MockFunction],
},
"basePath": BasePath {
"basePath": "",
"get": [Function],
"prepend": [Function],
"remove": [Function],
"serverBasePath": "",
},
"delete": [MockFunction],
"fetch": [MockFunction],
"get": [MockFunction],
"getLoadingCount$": [MockFunction],
"head": [MockFunction],
"intercept": [MockFunction],
"options": [MockFunction],
"patch": [MockFunction],
"post": [MockFunction],
"put": [MockFunction],
}
}
pplService={
PPLService {
"fetch": [Function],
"http": [MockFunction],
"http": Object {
"addLoadingCountSource": [MockFunction],
"anonymousPaths": Object {
"isAnonymous": [MockFunction],
"register": [MockFunction],
},
"basePath": BasePath {
"basePath": "",
"get": [Function],
"prepend": [Function],
"remove": [Function],
"serverBasePath": "",
},
"delete": [MockFunction],
"fetch": [MockFunction],
"get": [MockFunction],
"getLoadingCount$": [MockFunction],
"head": [MockFunction],
"intercept": [MockFunction],
"options": [MockFunction],
"patch": [MockFunction],
"post": [MockFunction],
"put": [MockFunction],
},
}
}
rawQuery="source = opensearch_dashboards_sample_data_logs | where match(request,'filebeat')"
Expand Down Expand Up @@ -203,7 +251,6 @@ exports[`Datagrid component Renders data grid component 1`] = `
},
]
}
rowsAll={Array []}
startTime="now/y"
storedSelectedColumns={
Array [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ import {
DATA_GRID_ROWS,
EXPLORER_DATA_GRID_QUERY,
} from '../../../../../test/event_analytics_constants';
import httpClientMock from '../../../../../test/__mocks__/httpClientMock';
import { sampleEmptyPanel } from '../../../../../test/panels_constants';
import { HttpResponse } from '../../../../../../../src/core/public';
import PPLService from '../../../../../public/services/requests/ppl';
import { Provider } from 'react-redux';
import { configureStore } from '@reduxjs/toolkit';
import { queriesReducer } from '../../redux/slices/query_slice';
import { coreMock } from '../../../../../../../src/core/public/mocks';

const coreStartMock = coreMock.createStart();

describe('Datagrid component', () => {
configure({ adapter: new Adapter() });
Expand All @@ -41,14 +43,13 @@ describe('Datagrid component', () => {
[QUERIED_FIELDS]: QUERY_FIELDS,
};

httpClientMock.get = jest.fn(() =>
Promise.resolve((sampleEmptyPanel as unknown) as HttpResponse)
);
coreStartMock.http.get = jest
.fn()
.mockResolvedValue((sampleEmptyPanel as unknown) as HttpResponse);

const tabId = 'explorer-tab-_fbef9141-48eb-11ee-a60a-af33302cfb3c';

const http = httpClientMock;
const pplService = new PPLService(httpClientMock);
const pplService = new PPLService(coreStartMock.http);
const preloadedState = {
queries: {
[tabId]: {
Expand All @@ -61,10 +62,9 @@ describe('Datagrid component', () => {
const wrapper = mount(
<Provider store={store}>
<DataGrid
http={http}
http={coreStartMock.http}
pplService={pplService}
rows={DATA_GRID_ROWS}
rowsAll={[]}
explorerFields={explorerFields}
timeStampField={'timestamp'}
rawQuery={EXPLORER_DATA_GRID_QUERY}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import { FlyoutButton } from './docViewRow';
import { selectQueries } from '../../redux/slices/query_slice';

export interface DataGridProps {
tabId: string;
http: HttpSetup;
pplService: PPLService;
rows: any[];

Check warning on line 37 in public/components/event_analytics/explorer/events_views/data_grid.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
Expand Down

0 comments on commit 06f69a9

Please sign in to comment.