feature-change-applier/src/reducers/stateReducer.features.test.js

34 lines
849 B
JavaScript
Raw Normal View History

import {stateReducer} from './stateReducer';
describe('Features', () => {
const state = {}
beforeEach(() => {
state.phones = {
a: {features: {occlusive: true}, grapheme: 'a'},
n: {features: {occlusive: false}, grapheme: 'n'}
};
state.features = {
occlusive: {
positive: [state.phones.n],
negative: [state.phones.a]
}
};
});
it('features returned unaltered', () => {
const action = {type: ''};
expect(stateReducer(state, action)).toBe(state);
});
2019-12-05 00:03:49 +00:00
it('feature addition returns new feature list', () => {
const action = {type: 'ADD_FEATURE', value: {feature: 'anterior'}};
expect(stateReducer(state, action)).toEqual(
{...state,
features:{...state.features,
anterior:{ positive:[], negative:[] }
}
}
);
});
2019-12-05 00:03:49 +00:00
});