@@ -22,7 +22,7 @@ import { openContextMenu } from '../context_menu';
2222import { uiActionsPluginMock } from '../mocks' ;
2323import { Trigger } from '../triggers' ;
2424import { TriggerId , ActionType } from '../types' ;
25- import { wait } from '@testing-library/dom' ;
25+ import { waitFor } from '@testing-library/dom' ;
2626
2727jest . mock ( '../context_menu' ) ;
2828
@@ -85,7 +85,7 @@ test('executes a single action mapped to a trigger', async () => {
8585 expect ( executeFn ) . toBeCalledWith ( expect . objectContaining ( context ) ) ;
8686} ) ;
8787
88- test ( 'throws an error if there are no compatible actions to execute' , async ( ) => {
88+ test ( "doesn't throw an error if there are no compatible actions to execute" , async ( ) => {
8989 const { setup, doStart } = uiActions ;
9090 const trigger : Trigger = {
9191 id : 'MY-TRIGGER' as TriggerId ,
@@ -98,9 +98,7 @@ test('throws an error if there are no compatible actions to execute', async () =
9898 const start = doStart ( ) ;
9999 await expect (
100100 start . executeTriggerActions ( 'MY-TRIGGER' as TriggerId , context )
101- ) . rejects . toMatchObject (
102- new Error ( 'No compatible actions found to execute for trigger [triggerId = MY-TRIGGER].' )
103- ) ;
101+ ) . resolves . toBeUndefined ( ) ;
104102} ) ;
105103
106104test ( '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
149147
150148 jest . runAllTimers ( ) ;
151149
152- await wait ( ( ) => {
150+ await waitFor ( ( ) => {
153151 expect ( executeFn ) . toBeCalledTimes ( 0 ) ;
154152 expect ( openContextMenu ) . toHaveBeenCalledTimes ( 1 ) ;
155153 } ) ;
@@ -197,7 +195,7 @@ test("doesn't show a context menu for auto executable actions", async () => {
197195
198196 jest . runAllTimers ( ) ;
199197
200- await wait ( ( ) => {
198+ await waitFor ( ( ) => {
201199 expect ( executeFn ) . toBeCalledTimes ( 2 ) ;
202200 expect ( openContextMenu ) . toHaveBeenCalledTimes ( 0 ) ;
203201 } ) ;
0 commit comments