easy-peasy
Version:
Vegetarian friendly state for React
30 lines (24 loc) • 585 B
JavaScript
import { action, createStore } from '../index';
test('deprecated action API does nothing', () => {
// act
const store = createStore({
count: 1,
increment: state => {
state.count += 1;
},
});
// assert
expect(store.getActions().increment).toBeUndefined();
});
test('returning the state has no effect', () => {
// arrange
const store = createStore({
count: 1,
doNothing: action(state => state),
});
const prevState = store.getState();
// act
store.getActions().doNothing();
// assert
expect(store.getState()).toBe(prevState);
});