Unit testing TextNode的等效酶是什么?我如何在单元测试中选择它?
我正在用jest和酶为一种反应成分编写测试,它看起来像这样: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
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"`;