diff --git a/packages/data/src/components/use-dispatch/test/use-dispatch.js b/packages/data/src/components/use-dispatch/test/use-dispatch.js
index 115279dd097df9..810fc675121840 100644
--- a/packages/data/src/components/use-dispatch/test/use-dispatch.js
+++ b/packages/data/src/components/use-dispatch/test/use-dispatch.js
@@ -1,7 +1,8 @@
/**
* External dependencies
*/
-import TestRenderer, { act } from 'react-test-renderer';
+import { render, screen } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
/**
* Internal dependencies
@@ -11,165 +12,171 @@ import createReduxStore from '../../../redux-store';
import { createRegistry } from '../../../registry';
import { RegistryProvider } from '../../registry-provider';
+jest.useRealTimers();
+
describe( 'useDispatch', () => {
+ const counterStore = {
+ reducer: ( state = 0, action ) => {
+ if ( action.type === 'INC' ) {
+ return state + 1;
+ }
+
+ return state;
+ },
+ actions: {
+ inc: () => ( { type: 'INC' } ),
+ },
+ selectors: {
+ get: ( state ) => state,
+ },
+ };
+
let registry;
beforeEach( () => {
registry = createRegistry();
} );
- it( 'returns dispatch function from store with no store name provided', () => {
- registry.registerStore( 'demoStore', {
- reducer: ( state ) => state,
- actions: {
- foo: () => 'bar',
- },
- } );
+ it( 'returns dispatch function from store with no store name provided', async () => {
+ const user = userEvent.setup();
+ registry.registerStore( 'demo', counterStore );
+
const TestComponent = () => {
- return
;
- };
- const Component = () => {
const dispatch = useDispatch();
- return ;
+ return