@types/redux-mock-store
Advanced tools
@@ -17,2 +17,30 @@ import * as Redux from "redux"; | ||
| /** | ||
| * @deprecated | ||
| * | ||
| * The Redux team does not recommend using this package for testing. Instead, check out our {@link https://redux.js.org/recipes/writing-tests testing docs} to learn more about testing Redux code. | ||
| * | ||
| * Testing with a mock store leads to potentially confusing behaviour, such as state not updating when actions are dispatched. Additionally, it's a lot less useful to assert on the actions dispatched rather than the observable state changes. | ||
| * | ||
| * You can test the entire combination of action creators, reducers, and selectors in a single test, for example: | ||
| * ```js | ||
| * it("should add a todo", () => { | ||
| * const store = makeStore(); // a user defined reusable store factory | ||
| * | ||
| * store.dispatch(addTodo("Use Redux")); | ||
| * | ||
| * expect(selectTodos(store.getState())).toEqual([{ text: "Use Redux", completed: false }]); | ||
| * }); | ||
| * ``` | ||
| * | ||
| * This avoids common pitfalls of testing each of these in isolation, such as mocked state shape becoming out of sync with the actual application. | ||
| * | ||
| * If you want to use `configureStore` without this visual deprecation warning, use the `legacy_configureStore` export instead. | ||
| * | ||
| * `import { legacy_configureStore as configureStore } from 'redux-mock-store';` | ||
| */ | ||
| export function configureStore<S, DispatchExts = {}>( | ||
| middlewares?: Redux.Middleware[], | ||
| ): MockStoreCreator<S, DispatchExts>; | ||
| /** | ||
| * Create Mock Store returns a function that will create a mock store from a state | ||
@@ -25,6 +53,4 @@ * with the same set of set of middleware applied. | ||
| */ | ||
| declare function createMockStore<S, DispatchExts = {}>( | ||
| middlewares?: Redux.Middleware[], | ||
| ): MockStoreCreator<S, DispatchExts>; | ||
| export const legacy_configureStore: typeof configureStore; | ||
| export default createMockStore; | ||
| export default configureStore; |
| { | ||
| "name": "@types/redux-mock-store", | ||
| "version": "1.0.6", | ||
| "version": "1.5.0", | ||
| "description": "TypeScript definitions for redux-mock-store", | ||
@@ -29,4 +29,5 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/redux-mock-store", | ||
| }, | ||
| "typesPublisherContentHash": "c3748f3cf1e666bcc324ba6e2983f8da51488c04dfbe76a4d82ef7c2c86f19f0", | ||
| "typeScriptVersion": "4.5" | ||
| "peerDependencies": {}, | ||
| "typesPublisherContentHash": "7a025bf15251fd963352b662b110eebf67e2a92ce85f00135ad146b1fae18337", | ||
| "typeScriptVersion": "4.9" | ||
| } |
@@ -27,2 +27,30 @@ # Installation | ||
| /** | ||
| * @deprecated | ||
| * | ||
| * The Redux team does not recommend using this package for testing. Instead, check out our {@link https://redux.js.org/recipes/writing-tests testing docs} to learn more about testing Redux code. | ||
| * | ||
| * Testing with a mock store leads to potentially confusing behaviour, such as state not updating when actions are dispatched. Additionally, it's a lot less useful to assert on the actions dispatched rather than the observable state changes. | ||
| * | ||
| * You can test the entire combination of action creators, reducers, and selectors in a single test, for example: | ||
| * ```js | ||
| * it("should add a todo", () => { | ||
| * const store = makeStore(); // a user defined reusable store factory | ||
| * | ||
| * store.dispatch(addTodo("Use Redux")); | ||
| * | ||
| * expect(selectTodos(store.getState())).toEqual([{ text: "Use Redux", completed: false }]); | ||
| * }); | ||
| * ``` | ||
| * | ||
| * This avoids common pitfalls of testing each of these in isolation, such as mocked state shape becoming out of sync with the actual application. | ||
| * | ||
| * If you want to use `configureStore` without this visual deprecation warning, use the `legacy_configureStore` export instead. | ||
| * | ||
| * `import { legacy_configureStore as configureStore } from 'redux-mock-store';` | ||
| */ | ||
| export function configureStore<S, DispatchExts = {}>( | ||
| middlewares?: Redux.Middleware[], | ||
| ): MockStoreCreator<S, DispatchExts>; | ||
| /** | ||
| * Create Mock Store returns a function that will create a mock store from a state | ||
@@ -35,7 +63,5 @@ * with the same set of set of middleware applied. | ||
| */ | ||
| declare function createMockStore<S, DispatchExts = {}>( | ||
| middlewares?: Redux.Middleware[], | ||
| ): MockStoreCreator<S, DispatchExts>; | ||
| export const legacy_configureStore: typeof configureStore; | ||
| export default createMockStore; | ||
| export default configureStore; | ||
@@ -45,3 +71,3 @@ ```` | ||
| ### Additional Details | ||
| * Last updated: Tue, 07 Nov 2023 20:08:00 GMT | ||
| * Last updated: Mon, 18 Nov 2024 12:03:08 GMT | ||
| * Dependencies: [redux](https://npmjs.com/package/redux) | ||
@@ -48,0 +74,0 @@ |
7432
53.49%47
113.64%74
54.17%