Skip to content

Commit

Permalink
fix JEST
Browse files Browse the repository at this point in the history
  • Loading branch information
alexwizp committed Oct 7, 2022
1 parent b2610b2 commit 1f1e145
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<EmbeddableInput>, filters }
);
expect(isCompatible).toHaveBeenCalledWith(expect.objectContaining({ filters }));
});

it('calls through to getHref helper', async () => {
const filters: Filter[] = [{ meta: { disabled: false } }];
await drilldown.execute(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 1f1e145

Please sign in to comment.