Add an optional default state to the dev key store
This is handy for setting the initial state in tests. test plan: - specs pass flag = none Change-Id: I757a254508806d249190fbcc044355a6ff31c051 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276965 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> QA-Review: Tucker Mcknight <tmcknight@instructure.com> Product-Review: Tucker Mcknight <tmcknight@instructure.com> Reviewed-by: Sean Scally <sean.scally@instructure.com>
This commit is contained in:
parent
c56ca86d13
commit
9f24e2a015
|
@ -16,9 +16,11 @@
|
|||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import actions from 'ui/features/developer_keys_v2/react/actions/developerKeysActions'
|
||||
import store from 'ui/features/developer_keys_v2/react/store/store'
|
||||
import storeCreator from 'ui/features/developer_keys_v2/react/store/store'
|
||||
import axios from '@canvas/axios'
|
||||
|
||||
const store = storeCreator()
|
||||
|
||||
QUnit.module('Developer key actions')
|
||||
|
||||
function thenStub() {
|
||||
|
|
|
@ -22,7 +22,9 @@ import page from 'page'
|
|||
import qs from 'qs'
|
||||
import DeveloperKeysApp from './App'
|
||||
import actions from './actions/developerKeysActions'
|
||||
import store from './store/store'
|
||||
import storeCreator from './store/store'
|
||||
|
||||
const store = storeCreator()
|
||||
|
||||
/**
|
||||
* Route Handlers
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
import {createStore, applyMiddleware, combineReducers} from 'redux'
|
||||
import ReduxThunk from 'redux-thunk'
|
||||
import _ from 'lodash'
|
||||
import listDeveloperKeysReducer from '../reducers/listDeveloperKeysReducer'
|
||||
import deactivateDeveloperKeyReducer from '../reducers/deactivateReducer'
|
||||
import activateDeveloperKeyReducer from '../reducers/activateReducer'
|
||||
|
@ -50,4 +51,9 @@ const developerKeysReducer = combineReducers({
|
|||
listDeveloperKeyScopes: listDeveloperKeyScopesReducer
|
||||
})
|
||||
|
||||
export default createStoreWithMiddleware(developerKeysReducer)
|
||||
export default (initialStateOverrides = {}) => {
|
||||
let defaultState = developerKeysReducer({}, {})
|
||||
defaultState = _.merge(defaultState, initialStateOverrides)
|
||||
|
||||
return createStoreWithMiddleware(developerKeysReducer, defaultState)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue