test('branch tests props and applies one of two HoCs, for true and false', () => {
const SayMyName = compose(withState('isBad', 'updateIsBad', false), branch(props => props.isBad, withProps({
name: 'Heisenberg'
}), withProps({
name: 'Walter'
})))(({
isBad,
name,
updateIsBad
}) => React.createElement("div", null, React.createElement("div", {
className: "isBad"
}, isBad ? 'true' : 'false'), React.createElement("div", {
className: "name"
}, name), React.createElement("button", {
onClick: () => updateIsBad(b => !b)
}, "Toggle")));
expect(SayMyName.displayName).toBe('withState(branch(Component))');
const wrapper = mount( React.createElement(SayMyName, null));
const getIsBad = () => wrapper.find('.isBad').text();
const getName = () => wrapper.find('.name').text();
const toggle = wrapper.find('button');
expect(getIsBad()).toBe('false');
expect(getName()).toBe('Walter');
toggle.simulate('click');
expect(getIsBad()).toBe('true');
expect(getName()).toBe('Heisenberg');
});