All files / lib/redux reducer.ts

90.32% Statements 28/31
57.14% Branches 8/14
100% Functions 3/3
90.32% Lines 28/31

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 321x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 14x 14x   1x 14x 14x   1x 14x 14x   1x 1x 1x 1x 1x 1x 1x 1x  
/**
 * @file reduxå¾·reducer
 * @Author wangjie19
 * @Date 2020-07-25 22:05:29
 * @Last Modified by: wangjie19
 * @Last Modified time: 2020-07-25 22:42:08
 */
 
import { combineReducers } from 'redux';
import { ROOT, DB, TABLE } from './actionTypes';
import { IAction } from '../interface';
 
function root(state = '', action: IAction) {
    return action.type === ROOT ? action.payload || state : state;
}
 
function db(state = '', action: IAction) {
    return action.type === DB ? action.payload || state : state;
}
 
function table(state = '', action: IAction) {
    return action.type === TABLE ? action.payload || state : state;
}
 
const reducers = {
    root,
    db,
    table
};
 
export default combineReducers(reducers);