Jest/Enzyme ShallowWrapper is empty when creating Snapshot

前端 未结 8 904
醉话见心
醉话见心 2020-12-28 15:25

So I\'m writing a test for my Item component and I tried to render the ItemCard component and then use that wrapper to create a snapshot but it returns an empty

8条回答
  •  暖寄归人
    2020-12-28 16:21

    use debug() method after the wrapper

      it('renders and matches the snapshot', () => {
    const wrapper = shallow();
    
    // console.log(wrapper.debug());
    expect(wrapper.debug()).toMatchSnapshot(); });
    

提交回复
热议问题