reusable-react-redux
Version:
Library to facilitate building reusable react redux components.
21 lines (16 loc) • 678 B
JavaScript
const stateMerge = require('../src/state-merge.js');
describe('Reusable React Redux StateMerge', function () {
it('creates a new state with a modified state slice', function () {
const originalState = { foo: 'foo' };
const stateKey = 'foo';
const newState = stateMerge(originalState, stateKey, 'bar');
expect(newState).not.toBe(originalState);
expect(newState.foo).toEqual('bar');
});
it('does not create a new state with a modified state slice', function () {
const originalState = { foo: 'foo' };
const stateKey = 'foo';
const newState = stateMerge(originalState, stateKey, 'foo');
expect(newState).toBe(originalState);
});
});