Redux Test Store is a utility library designed to simplify the unit testing of existing Redux stores, focusing on verifying state changes in response to dispatched actions. It allows developers to create a 'testStore' instance that wraps a standard Redux store, providing methods like `when` to assert state mutations and `dispatch` to trigger actions within a controlled testing environment. The package is currently at version 0.5.0, with its last update occurring over seven years ago. Consequently, it is no longer actively maintained and should be considered abandoned. Due to its age and lack of updates, it likely lacks compatibility with contemporary Redux versions (e.g., Redux Toolkit), modern JavaScript features, or current testing practices and tools. Developers should be cautious about using it in new projects or integrating it into modern React/Redux applications.
npm install redux-test-storeVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `redux-test-store` to test an asynchronous Redux action, asserting state changes upon successful dispatch using a `done` callback.
Consider migrating to actively maintained Redux testing libraries like `@reduxjs/toolkit/query/react/test-utils` or writing custom mocks/fixtures with standard testing tools (e.g., Jest, Vitest).
Ensure that `done()` is called exactly once, typically after all assertions related to the async action are complete. For more complex async tests, consider using `jest.useFakeTimers()` or modern async testing utilities.
Regularly audit your `node_modules` for known vulnerabilities. The most robust fix is to replace this library with a currently maintained alternative.
Use named import syntax: `import createTestStore from 'redux-test-store';`
Ensure `done()` is called at the appropriate point after all asynchronous operations and assertions are finished within your test. Check for unhandled promises or forgotten `setTimeout` calls.
Add `import assert from 'assert';` at the top of your test file, or use a testing framework's assertion library (e.g., `expect` from Jest/Vitest) which is globally available or imported from the framework.