From 1f1e14591038c2a421ff6c01c3756aa0a6cf7727 Mon Sep 17 00:00:00 2001 From: Alexey Antonov Date: Fri, 7 Oct 2022 17:51:41 +0300 Subject: [PATCH] fix JEST --- .../trigger_actions/open_in_discover_drilldown.test.tsx | 6 ++++-- .../public/trigger_actions/open_in_discover_drilldown.tsx | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/lens/public/trigger_actions/open_in_discover_drilldown.test.tsx b/x-pack/plugins/lens/public/trigger_actions/open_in_discover_drilldown.test.tsx index 26332f0cf0054..84ae2a21a9a92 100644 --- a/x-pack/plugins/lens/public/trigger_actions/open_in_discover_drilldown.test.tsx +++ b/x-pack/plugins/lens/public/trigger_actions/open_in_discover_drilldown.test.tsx @@ -48,14 +48,16 @@ describe('open in discover drilldown', () => { instance.find('EuiSwitch').prop('onChange')!({} as unknown as FormEvent<{}>); expect(setConfig).toHaveBeenCalledWith({ openInNewTab: true }); }); - it('calls through to isCompatible helper', () => { + + it('calls through to isCompatible helper', async () => { const filters: Filter[] = [{ meta: { disabled: false } }]; - drilldown.isCompatible( + await drilldown.isCompatible( { openInNewTab: true }, { embeddable: { type: 'lens' } as IEmbeddable, filters } ); expect(isCompatible).toHaveBeenCalledWith(expect.objectContaining({ filters })); }); + it('calls through to getHref helper', async () => { const filters: Filter[] = [{ meta: { disabled: false } }]; await drilldown.execute( diff --git a/x-pack/plugins/lens/public/trigger_actions/open_in_discover_drilldown.tsx b/x-pack/plugins/lens/public/trigger_actions/open_in_discover_drilldown.tsx index 37e8976255362..fa262c6b0d534 100644 --- a/x-pack/plugins/lens/public/trigger_actions/open_in_discover_drilldown.tsx +++ b/x-pack/plugins/lens/public/trigger_actions/open_in_discover_drilldown.tsx @@ -131,11 +131,11 @@ export class OpenInDiscoverDrilldown }; public readonly execute = async (config: Config, context: ActionContext) => { - const { getLocation } = await getDiscoverHelpersAsync(); - if (config.openInNewTab) { window.open(await this.getHref(config, context), '_blank'); } else { + const { getLocation } = await getDiscoverHelpersAsync(); + const { app, path, state } = await getLocation({ discover: this.deps.discover, dataViews: this.deps.dataViews(),