import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import type { AnyAction } from 'redux'; import { describe, expect, it } from 'vitest'; import useDispatch from '../use-dispatch'; import createReduxStore from '../../../redux-store'; import { createRegistry } from '../../../registry'; import { RegistryProvider } from '../../registry-provider'; describe( 'useDispatch', () => { const counterStore = { reducer: ( state = 0, action: AnyAction ) => { if ( action.type === 'INC' ) { return state + 1; } return state; }, actions: { inc: () => ( { type: 'INC' } ), }, selectors: { get: ( state: number ) => state, }, }; it( 'returns dispatch function from store with no store name provided', async () => { const user = userEvent.setup(); const registry = createRegistry(); registry.registerStore( 'demo', counterStore ); const TestComponent = () => { const dispatch = useDispatch(); return (