mocks.ts 509 B

123456789101112
  1. import { ActionCreatorWithoutPayload, PayloadActionCreator } from '@reduxjs/toolkit';
  2. export const mockToolkitActionCreator = (creator: PayloadActionCreator<any>) => {
  3. return Object.assign(jest.fn(), creator);
  4. };
  5. export type ToolkitActionCreatorWithoutPayloadMockType = typeof mockToolkitActionCreatorWithoutPayload &
  6. ActionCreatorWithoutPayload<any>;
  7. export const mockToolkitActionCreatorWithoutPayload = (creator: ActionCreatorWithoutPayload<any>) => {
  8. return Object.assign(jest.fn(), creator);
  9. };