score:2

looking at source of gameboard's handleclick we can see it does not call this.props.onclick().

instead it calls

    this.props.updateactiveboardarray(e.target.id)
    this.props.changeturn()

so you have to pass those props in your test and check if they are called:

const e = { target: {id:'x'} }
const updateactiveboardarray = jest.fn();
const changeturn= jest.fn();

let wrapper = shallow(<gameboard 
    updateactiveboardarray={updateactiveboardarray}
    changeturn={changeturn}
/>);
let test = wrapper.find("#gameboard").childat(0).simulate('click', e);
expect(updateactiveboardarray).tohavebeencalledtimes(1);
expect(updateactiveboardarray).tohavebeencalledwith('x');
expect(changeturn).tohavebeencalledtimes(1);

Related Query

More Query from same tag