Jest - how to test if a component does not exist?

后端 未结 5 2003
离开以前
离开以前 2021-02-04 23:15

How do I check if a component is not present, i.e. that a specific component has not been rendered?

5条回答
  •  感情败类
    2021-02-04 23:57

    You can use enzymes contains to check if the component was rendered:

    expect(component.contains()).toBe(false)
    

提交回复
热议问题