wheel-test-react-model
v1.0.2
Published
reactjs项目数据层测试
Downloads
5
Readme
##Aes latest update at 2017-01-19 author Able ####Des 用于React项目数据层测试 ####Usage Action
const Action = {
test:(params)=>{
return (dispatch)=>{
// do something
dispatch(...);
}
}
Reducer
const defaultUserState = {
userInfo: {},
loginInfo: {},
testParams: {}
}
export default function userReducer(state = defaultUserState, action) {
switch (action.type) {
case 'TEST':
return Object.assign({}, state, {testParams: action.params})
default:
return state;
}
}
Test
import Action from './model/action';
import Reducer from './model/reducer';
import createProvider from 'wheel-test-react-model';
const cp = new createProvider(Action, Reducer);
const defaultActionParams = {
login: 'account=admin;password=admin',
test: 'name=test'
}
const Test = cp.createContainer(defaultActionParams);
export default Test;