弄清楚了!不需要React测试实用程序
it('should render the Notification component if state.error is true', () => { const loginComponent = shallow(<Login />); loginComponent.setState({ error: true }); expect(loginComponent.find(Notification).length).toBe(1);});这将在 Login 组件中将错误状态设置为true ,然后检查 Login 组件是否包含 Notification 组件。



