diff --git a/assets/js/blocks/cart/inner-blocks/proceed-to-checkout-block/test/block.tsx b/assets/js/blocks/cart/inner-blocks/proceed-to-checkout-block/test/block.tsx index c67f5e1e972..6b886da7950 100644 --- a/assets/js/blocks/cart/inner-blocks/proceed-to-checkout-block/test/block.tsx +++ b/assets/js/blocks/cart/inner-blocks/proceed-to-checkout-block/test/block.tsx @@ -52,34 +52,34 @@ describe( 'Proceed to checkout block', () => { ); //@todo When https://github.com/WordPress/gutenberg/issues/22850 is complete use that new matcher here for more specific error message assertion. expect( console ).toHaveErrored(); - it( 'dispatches the onProceedToCheckout event when the button is clicked', async () => { - const mockObserver = jest.fn(); - const MockObserverComponent = () => { - const { onProceedToCheckout } = useCartEventsContext(); - useEffect( () => { - return onProceedToCheckout( mockObserver ); - }, [ onProceedToCheckout ] ); - return
Mock observer
; - }; + } ); + it( 'dispatches the onProceedToCheckout event when the button is clicked', async () => { + const mockObserver = jest.fn(); + const MockObserverComponent = () => { + const { onProceedToCheckout } = useCartEventsContext(); + useEffect( () => { + return onProceedToCheckout( mockObserver ); + }, [ onProceedToCheckout ] ); + return
Mock observer
; + }; - render( - -
- - -
-
- ); - expect( screen.getByText( 'Mock observer' ) ).toBeInTheDocument(); - const button = screen.getByText( 'Proceed to Checkout' ); - button.click(); - await waitFor( () => { - expect( mockObserver ).toHaveBeenCalled(); - } ); + render( + +
+ + +
+
+ ); + expect( screen.getByText( 'Mock observer' ) ).toBeInTheDocument(); + const button = screen.getByText( 'Proceed to Checkout' ); + button.click(); + await waitFor( () => { + expect( mockObserver ).toHaveBeenCalled(); } ); } ); } );