Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Unit testing TextNode的等效酶是什么?我如何在单元测试中选择它?_Unit Testing_Enzyme_Jestjs_Acceptance Testing - Fatal编程技术网

Unit testing TextNode的等效酶是什么?我如何在单元测试中选择它?

Unit testing TextNode的等效酶是什么?我如何在单元测试中选择它?,unit-testing,enzyme,jestjs,acceptance-testing,Unit Testing,Enzyme,Jestjs,Acceptance Testing,我正在用jest和酶为一种反应成分编写测试,它看起来像这样: function Message(props) { return ( <div> <span>{props.message}</span> </div> ); } Message.propTypes = { message: PropTypes.string.isRequired }; exports[`the component renders p

我正在用jest和酶为一种反应成分编写测试,它看起来像这样:

function Message(props) {
  return (
    <div>
      <span>{props.message}</span>
    </div>
  );
}
Message.propTypes = { message: PropTypes.string.isRequired };
exports[`the component renders props.message 1`] = `"hello"`;
考试通过了,这很好。但如果我不小心更新了我的组件:

function Message(props) {
  return (
    <div>
      <span>{props.message}</span>
      <span>{props.message}</span>
    </div>
  );
}
为什么酶将多个findWhere结果折叠为单个节点?我能阻止它那样做吗?有没有其他的酶法可以替代

谢谢

exports[`the component renders props.message 1`] = `"hello"`;