import * as React from "react"; import { Middleware, Store } from "redux"; import { TRenderResult, Wrapper } from "./Wrapper.js"; import { DeepPartial } from "../types.js"; type TResultWithStore = TRenderResult

& { store: Store; }; /** * A class to provide a simple method of setting up your React component tests for apps that use Redux. */ export declare abstract class WrapperWithRedux, S extends Record, P extends React.ComponentProps = React.ComponentProps> extends Wrapper { /** * Determines whether arrays in Redux state are merged when rendering the component. */ protected isMergingReduxArrays: boolean; /** * The default Redux store state for all test scenarios for the current test suite. * * This is set by the `.withDefaultReduxState()` method. */ protected defaultReduxState: DeepPartial; /** * An array of all actions dispatched during the test scenario lifecycle */ protected dispatchedActions: any[]; /** * The Redux store state specific to the current test scenario. * * This is set by the `.withReduxState()` method and cleared after `.mount()` is called. */ protected scenarioReduxState: DeepPartial; /** * The Redux store instance. * * This is set during the `.beforeRender()` hook. */ protected reduxStore: Store | undefined; /** * Returns an array of all actions that were dispatched during the test scenario lifecycle */ get reduxHistory(): any[]; /** * Returns the merged Redux store state used by the current test scenario */ protected get mergedReduxState(): S; /** * Toggles whether to merge arrays in the Redux state * * @param value The new value */ withMergedReduxArrays: (value: boolean) => this; /** * Sets the default Redux store state used by all test scenarios for the current test suite. * * This method can be chained with other methods. * * @param state The partial Redux store state to set */ withDefaultReduxState: (state: DeepPartial) => this; /** * Sets the Redux store state used by the current test scenario. * * This method can be chained with other methods. * * @param state The partial Redux store state to set */ withReduxState: (state: DeepPartial) => this; /** * Renders the component using the `render` function from `react-testing-library`. * * Returns the `RenderResult` from `render()`, with `store` included. */ render: () => TResultWithStore; /** * Resets the Redux action history */ resetReduxHistory: () => void; /** * The beforeRender hook. * * This sets the instance of the Redux store used by the current test scenario. */ protected beforeRender: () => void; /** * The middleware for keeping track of actions that were dispatched during the test scenario lifecycle */ protected reduxHistoryMiddleware: Middleware; /** * The component to wrap the component you're testing - provides the Redux `Provider` component */ protected WrappingComponent: React.FC; /** * Resets all scenario-specific props, children and Redux store state for the instance */ protected reset(): void; /** * The method used to create your app's Redux store instance. * * You must implement this method when extending this class. * * @param initialState The initial Redux store state to create the store instance with * @param middlewares The middlewares to create the Redux store with */ protected abstract createStore(initialState: DeepPartial, middlewares: Middleware[]): Store; } export {};