patch export error
This commit is contained in:
parent
ab02f945c6
commit
24b032e6f7
2 changed files with 22 additions and 6 deletions
|
@ -34,4 +34,19 @@ describe('Epochs', () => {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('epoch changes mutation returns new epochs list with mutation', () => {
|
||||||
|
const firstAction = {type: 'ADD_EPOCH', value: { name: 'epoch 2', changes: []}};
|
||||||
|
const secondAction = {type: 'SET_EPOCH', value: { index: 0, changes: ['n>t/_#', '[+plosive]>[+nasal -plosive]/_n']}};
|
||||||
|
const secondState = stateReducer(state, firstAction);
|
||||||
|
expect(stateReducer(secondState, secondAction)).toEqual(
|
||||||
|
{...state,
|
||||||
|
epochs: [
|
||||||
|
{name: 'epoch 1', changes: ['n>t/_#', '[+plosive]>[+nasal -plosive]/_n']},
|
||||||
|
{name: 'epoch 2', changes: []}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
|
@ -1,6 +1,9 @@
|
||||||
const initState = () => {
|
export const initState = () => {
|
||||||
return {
|
return {
|
||||||
|
epochs: [],
|
||||||
|
lexicon: [],
|
||||||
|
phones: {},
|
||||||
|
features: {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +35,7 @@ const addFeatureToPhone = (phones, phone, featureKey, featureValue) => {
|
||||||
return phones;
|
return phones;
|
||||||
}
|
}
|
||||||
|
|
||||||
const stateReducer = (state, action) => {
|
export const stateReducer = (state, action) => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case 'INIT': {
|
case 'INIT': {
|
||||||
return initState();
|
return initState();
|
||||||
|
@ -107,6 +110,4 @@ const stateReducer = (state, action) => {
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {initState, stateReducer}
|
|
Loading…
Reference in a new issue