title: Unit testing a React function in component
body: <p>I need a way to unit test the "edit" function in the code below. It is different form the other questions because my function returns no value.</p>
  
  <pre><code>class QslTable extends React.PureComponent {
          this.state = {
          data: [{
              key: '0',
              callSign: {
                  editable: true,
                  value: 'F1ABD',
              },
              QSODate: {
                  editable: true,
                  value: '10-05-31',
              },
              band: {
                  editable: true,
                  value: '32',
              },
              mode: {
                  editable: true,
                  value: 'Phone',
              },
              dxccEntity: {
                  editable: true,
                  value: 'France',
              },
              delete: {
                  editable: false,
                  value: 'Delete',
              },
          }],
      };
  
        edit(index) {
          const { data } = this.state;
          Object.keys(data[index]).forEach((item) =&gt; {
              if (data[index][item] &amp;&amp; typeof data[index][item].editable !== 'undefined') {
                  data[index][item].editable = true;
              }
          });
          this.setState({ data });
      }
  }
  </code></pre>
  
  <p>This doesn't work:</p>
  
  <pre><code>it('should render the component', () =&gt; {
      const renderedComponent = shallow(&lt;QslTable /&gt;);
  
      expect(renderedComponent.find('edit')).toBeDefined();
  
  });
  </code></pre>
  
  <p>The function doesn't return any value. I have no clue how to test the function. I have looked at the documentation for Jest, but couldn't figure it out. Any help would be appreciated!</p>