stub ADD_FEATURE reducer action

This commit is contained in:
Sorrel Bri 2019-12-04 16:03:49 -08:00
parent a6b362efda
commit afea8906e1
2 changed files with 11 additions and 1 deletions

View file

@ -5,7 +5,7 @@ describe('Features', () => {
features: [ features: [
'low', 'high','back', 'rounded', 'sonorant', 'low', 'high','back', 'rounded', 'sonorant',
'nasal', 'obstruent', 'occlusive', 'plosive', 'nasal', 'obstruent', 'occlusive', 'plosive',
'prenasalized', 'aspirated', 'coronal', 'anterior' 'prenasalized', 'aspirated', 'coronal'
] ]
}; };
@ -14,4 +14,9 @@ describe('Features', () => {
expect(stateReducer(state, action)).toBe(state); expect(stateReducer(state, action)).toBe(state);
}); });
it('feature addition returns new feature list', () => {
const action = {type: 'ADD_FEATURE', value: {feature: 'anterior'}};
expect(stateReducer(state, action)).toEqual({...state, features:[...state.features, action.value.feature]})
})
}); });

View file

@ -24,6 +24,11 @@ const stateReducer = (state, action) => {
return {...state, lexicon: newLexicon} return {...state, lexicon: newLexicon}
} }
case 'ADD_FEATURE': {
let newFeature = action.value.feature;
return {...state, features:[...state.features, newFeature]}
}
default: default:
return state; return state;
} }