diff --git a/common/constants/shared.ts b/common/constants/shared.ts index 4ae3acbca..d452b14c4 100644 --- a/common/constants/shared.ts +++ b/common/constants/shared.ts @@ -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']; diff --git a/public/components/event_analytics/explorer/__tests__/__snapshots__/data_grid.test.tsx.snap b/public/components/event_analytics/explorer/__tests__/__snapshots__/data_grid.test.tsx.snap index 7bf0356b3..1c01b9e62 100644 --- a/public/components/event_analytics/explorer/__tests__/__snapshots__/data_grid.test.tsx.snap +++ b/public/components/event_analytics/explorer/__tests__/__snapshots__/data_grid.test.tsx.snap @@ -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')" @@ -203,7 +251,6 @@ exports[`Datagrid component Renders data grid component 1`] = ` }, ] } - rowsAll={Array []} startTime="now/y" storedSelectedColumns={ Array [ diff --git a/public/components/event_analytics/explorer/__tests__/data_grid.test.tsx b/public/components/event_analytics/explorer/__tests__/data_grid.test.tsx index 9e633c717..9ae2c345e 100644 --- a/public/components/event_analytics/explorer/__tests__/data_grid.test.tsx +++ b/public/components/event_analytics/explorer/__tests__/data_grid.test.tsx @@ -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() }); @@ -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]: { @@ -61,10 +62,9 @@ describe('Datagrid component', () => { const wrapper = mount(