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.
const value = React.useContext(SomeContext);
      return (
        <div>
          <p>{value}</p>
        </div>
      );
    }
    const shallowRenderer = createRenderer();
    let result = shallowRenderer.render(<SomeComponent />);
    expect(result).toEqual(
      <div>
        <p>default</p>
      </div>,
    );
  });
  it('should not leak state when component type changes', () => {
    function SomeComponent({defaultName}) {