See the issue and the test case with original fix in https://github.com/facebook/react/pull/14802.

We'll need to fix it properly, see https://github.com/facebook/react/pull/14802#issuecomment-463277621.
);
  });
  it('should work with updating a value from useState', () => {
    function SomeComponent({defaultName}) {
      const [name, updateName] = React.useState(defaultName);
      if (name !== 'Dan') {
        updateName('Dan');
      }
      return (
        <div>
          <p>
            Your name is: <span>{name}</span>
          </p>
        </div>
      );
    }
    const shallowRenderer = createRenderer();
    const result = shallowRenderer.render(
      <SomeComponent defaultName={'Dominic'} />,
    );
    expect(result).toEqual(
      <div>
        <p>
          Your name is: <span>Dan</span>
        </p>
      </div>,
    );
  });
  it('should work with useReducer', () => {
    function reducer(state, action) {