如何使用Jest模拟对Font Awesome Icon的点击?

我正在通过Jest测试,并试图测试对Font Awesome Icon的点击。我尝试了不同的方法来查找“节点”,但是出现了“方法“模拟”应在1个节点上运行,而是找到0个错误”的错误消息。任何见解都会有所帮助。

The error I get when I try different inputs to component.find() is: Method “simulate” is meant to be run on 1 node. 0 found instead.

字符串编辑器

const clearInput = () => {
    onRemove()
}

render (
    ...
    <FontAwesomeIcon icon={['fal', 'times-circle']} className="clear-button" 
    onClick={clearInput} /> : null`
) 

onRemove is a callback function.

it('should call clearInput thus onRemove', () =>{

    const onRemove= jest.fn()
    const component = mount(<StringEditor {...defaultProps}  onRemove={onRemove} />)
    component.find('<dont know what to put>').simulate('click')
    expect(saveValueFn).toBeCalled()
})