React测试库不是解析JSON
我有一个Textarea组件,可以将JSON {“ SomeKey”:“ SomeValue”}
。当我检查DOM时,{“ somekey”:“ someValue”}
在检查员中显示得很好。
但是,当我尝试React测试库时,RTL认为TextArea似乎包含“ [对象对象]”
,不可解析。
任何洞察力
- 关于RTL为什么将此JSON解释为
“ [对象对象]”
- 我如何测试它的 ?我想断言我输入的价值在那里
I have a TextArea component that takes JSON {"someKey": "someValue"}
. When I inspect the dom, {"someKey": "someValue"}
shows up just fine in the inspector.
However, when I try react testing library, RTL thinks the TextArea seems to contain "[object Object]"
which isn't JSON parseable.
Any insight into
- Why RTL is interpreting this json as
"[object Object]"
- How I can test it? I'd like to assert the value I typed in is there
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论