Q:

How do i simulate a button click in Enzyme React?

Simulating a button click seems like a very easy/standard operation. However,  I can't get it to work in reacyt Jest.js tests.
Below is what i have tried, what the error message is and my code that i want to test
The code i would like to test
class Home extends React.Component {

  constructor(props) {
    super(props)

    this.state = { 
      showAssessment: false
    };
  }
  assessment = (boolean) => {
    this.setState({
      showAssessment: boolean
    })
  }

  render() {
    if (this.state.showAssessment === true) {
      return <App
          assessment = {
            this.assessment
          }
      />
    } else {
      return ( < div className='container-fluid' style={landingPage}>
        <
            Component1 / >
        <
          button className='btn btn-dark' style={matchToolButton} onClick = {
          () => this.assessment(true)
        } >  Match Tool < /button> < /
            div > )
          }
          }

          }

The Test that i have written:
import React from 'react';

import { shallow, mount, render } from 'enzyme';

import Home from './Home';

test ('Home Button', () => {
    it ('It calls assessment function when clicked', () => {

        const wrapper = mount(<Home/>); // rednoing the home componenet/ testing
         wrapper.instance().assessment = jest.fn(); //if this isn't working try wrapper.instance().assessment

        wrapper.find('button').simulate('click');
        expect(wrapper.assessment).toHaveBeenCalled();// see comment on line 14 keep the same

    });

    });

The error message that i am getting

FAIL  src/Home.test.js
  ● Test suite failed to run

    /Users/mbyousaf/Desktop/Bucket/dsp_poc2_uwe/front-end/src/Home.test.js: Unexpected token (12:30)
        10 | 
        11 | 
      > 12 |         const wrapper = mount(<Home/>); // rednoing the home componenet/ testing
           |                               ^
        13 |          wrapper.instance().assessment = jest.fn(); //if this isn't working try wrapper.instance().assessment
        14 | 
        15 |         wrapper.find('button').simulate('click');

A:

I used renderprops.cjs.js instead of renderprops.js?. This solved my issue. 
That libraries depends on the es-modules version of @babel/runtime, which needs to be used with webpack or rollup.
Have a nice day :)

