2019-12-04 23:52:46 +00:00
|
|
|
import {stateReducer} from './stateReducer';
|
|
|
|
|
|
|
|
describe('Features', () => {
|
2019-12-05 04:28:48 +00:00
|
|
|
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]
|
|
|
|
}
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2019-12-04 23:52:46 +00:00
|
|
|
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'}};
|
2019-12-05 04:28:48 +00:00
|
|
|
expect(stateReducer(state, action)).toEqual(
|
|
|
|
{...state,
|
|
|
|
features:{...state.features,
|
|
|
|
anterior:{ positive:[], negative:[] }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
});
|
2019-12-05 00:03:49 +00:00
|
|
|
|
2019-12-04 23:52:46 +00:00
|
|
|
});
|