【发布时间】:2019-12-04 13:49:04
【问题描述】:
我要测试return null;
我已经尝试过 expect(comp.type()).toEqual(null) 和 expect(comp.get(0)).toBeFalsy() 都不适合我。
abc.js
render() {
const { hasError } = this.state;
if (hasError) {
return null;
}
.....
}
abc.test.js
it('+++ incorporates Search', () => {
wrapper.setState({ hasError: true });
console.log(wrapper.debug());
});
控制台为我提供数据。
【问题讨论】:
-
这不起作用。我没有让包装器为空。我正在使用数据包装
标签: javascript jestjs