{"library":"redux-test-store","title":"Redux Test Store","description":"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.","language":"javascript","status":"abandoned","last_verified":"Sun Apr 19","install":{"commands":["npm install redux-test-store"],"cli":null},"imports":["import createTestStore from 'redux-test-store';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import createTestStore from 'redux-test-store';\nimport { createStore, applyMiddleware } from 'redux';\nimport thunk from 'redux-thunk';\nimport assert from 'assert';\n\n// Dummy Redux store setup for example\nconst initialState = { auth: { sets: [] }, data: null };\nconst authReducer = (state = initialState.auth, action) => {\n  switch (action.type) {\n    case 'AUTH_SUCCESS':\n      return { ...state, sets: action.payload };\n    case 'CHANGE': // For the example's assertion\n      return { ...state, sets: action.payload };\n    default:\n      return state;\n  }\n};\nconst rootReducer = (state = initialState, action) => ({\n  auth: authReducer(state.auth, action),\n  data: state.data\n});\n\nconst store = createStore(rootReducer, applyMiddleware(thunk));\n\nconst actionTypes = {\n  CHANGE: 'CHANGE',\n  AUTHENTICATE: 'AUTHENTICATE_REQUEST'\n};\n\nconst actions = {\n  authenticate: ({ email, password }) => dispatch => {\n    // Simulate an async auth action\n    setTimeout(() => {\n      const tokenSet = [{ token: 1 }, { token: 2 }];\n      dispatch({\n        type: actionTypes.CHANGE,\n        payload: tokenSet\n      });\n    }, 10);\n  }\n};\n\ndescribe('auth action creators', () => {\n  it('should authenticate successfully', (done) => {\n    let tokenSet = [{ token: 1 }, { token: 2 }];\n\n    const testStore = createTestStore(store, done);\n\n    testStore.when(actionTypes.CHANGE, (state, action) => {\n      assert.deepStrictEqual(state.auth.sets, tokenSet);\n    });\n\n    testStore.dispatch(actions.authenticate({\n      email: 'foo@bar.com',\n      password: 'goat'\n    }));\n  });\n});","lang":"javascript","description":"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}