From 43f615f77007f41aa91a989ed3960e759cb9beff Mon Sep 17 00:00:00 2001 From: Paul Sebastian Date: Mon, 11 Mar 2024 13:54:45 -0700 Subject: [PATCH] add test with different user timestamp Signed-off-by: Paul Sebastian --- .../__snapshots__/data_grid.test.tsx.snap | 486 ++++++++++++++++++ .../explorer/__tests__/data_grid.test.tsx | 49 ++ 2 files changed, 535 insertions(+) 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 1c01b9e62..381856443 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 @@ -485,3 +485,489 @@ exports[`Datagrid component Renders data grid component 1`] = ` `; + +exports[`Datagrid component renders data grid with different timestamp 1`] = ` + + + +
+
+ + + + + +
+ +
+
+
+ +
+ + + + + +
+
+ + + +`; 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 9ae2c345e..d9af5b86b 100644 --- a/public/components/event_analytics/explorer/__tests__/data_grid.test.tsx +++ b/public/components/event_analytics/explorer/__tests__/data_grid.test.tsx @@ -83,4 +83,53 @@ describe('Datagrid component', () => { expect(wrapper).toMatchSnapshot(); }); }); + + it('renders data grid with different timestamp', async () => { + const explorerFields = { + [SELECTED_FIELDS]: [], + [UNSELECTED_FIELDS]: [], + [AVAILABLE_FIELDS]: SIDEBAR_AVAILABLE_FIELDS, + [QUERIED_FIELDS]: QUERY_FIELDS, + }; + + coreStartMock.http.get = jest + .fn() + .mockResolvedValue((sampleEmptyPanel as unknown) as HttpResponse); + + const tabId = 'explorer-tab-_fbef9141-48eb-11ee-a60a-af33302cfb3c'; + + const pplService = new PPLService(coreStartMock.http); + const preloadedState = { + queries: { + [tabId]: { + [SELECTED_TIMESTAMP]: 'utc_time', + }, + }, + }; + const store = configureStore({ reducer: queriesReducer, preloadedState }); + + const wrapper = mount( + + + + ); + + wrapper.update(); + + await waitFor(() => { + expect(wrapper).toMatchSnapshot(); + }); + }); });