diff --git a/src/plugins/ui_actions/public/tests/execute_trigger_actions.test.ts b/src/plugins/ui_actions/public/tests/execute_trigger_actions.test.ts index 81120990001e3..af2510467ba87 100644 --- a/src/plugins/ui_actions/public/tests/execute_trigger_actions.test.ts +++ b/src/plugins/ui_actions/public/tests/execute_trigger_actions.test.ts @@ -22,7 +22,7 @@ import { openContextMenu } from '../context_menu'; import { uiActionsPluginMock } from '../mocks'; import { Trigger } from '../triggers'; import { TriggerId, ActionType } from '../types'; -import { wait } from '@testing-library/dom'; +import { waitFor } from '@testing-library/dom'; jest.mock('../context_menu'); @@ -85,7 +85,7 @@ test('executes a single action mapped to a trigger', async () => { expect(executeFn).toBeCalledWith(expect.objectContaining(context)); }); -test('throws an error if there are no compatible actions to execute', async () => { +test("doesn't throw an error if there are no compatible actions to execute", async () => { const { setup, doStart } = uiActions; const trigger: Trigger = { id: 'MY-TRIGGER' as TriggerId, @@ -98,9 +98,7 @@ test('throws an error if there are no compatible actions to execute', async () = const start = doStart(); await expect( start.executeTriggerActions('MY-TRIGGER' as TriggerId, context) - ).rejects.toMatchObject( - new Error('No compatible actions found to execute for trigger [triggerId = MY-TRIGGER].') - ); + ).resolves.toBeUndefined(); }); test('does not execute an incompatible action', async () => { @@ -149,7 +147,7 @@ test('shows a context menu when more than one action is mapped to a trigger', as jest.runAllTimers(); - await wait(() => { + await waitFor(() => { expect(executeFn).toBeCalledTimes(0); expect(openContextMenu).toHaveBeenCalledTimes(1); }); @@ -197,7 +195,7 @@ test("doesn't show a context menu for auto executable actions", async () => { jest.runAllTimers(); - await wait(() => { + await waitFor(() => { expect(executeFn).toBeCalledTimes(2); expect(openContextMenu).toHaveBeenCalledTimes(0); }); diff --git a/src/plugins/ui_actions/public/triggers/trigger_internal.ts b/src/plugins/ui_actions/public/triggers/trigger_internal.ts index c91468d31add5..c766b5c798ecb 100644 --- a/src/plugins/ui_actions/public/triggers/trigger_internal.ts +++ b/src/plugins/ui_actions/public/triggers/trigger_internal.ts @@ -35,12 +35,6 @@ export class TriggerInternal { const triggerId = this.trigger.id; const actions = await this.service.getTriggerCompatibleActions!(triggerId, context); - if (!actions.length) { - throw new Error( - `No compatible actions found to execute for trigger [triggerId = ${triggerId}].` - ); - } - await Promise.all([ actions.map((action) => this.service.executionService.execute({