D
D
danilr2021-12-01 09:06:07
React
danilr, 2021-12-01 09:06:07

How to test the enzyme mini component?

export const Boz = (props) => (
  <MuiBoz {...props} />
);


How to test this component, namely we make it shallow and check that the component that is wrapped is present. What would be the condition in expect ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2021-12-01
@slide13

Via find

const wrapper = shallow(<Boz/>);
expect(wrapper.find(MuiBoz)).to.have.lengthOf(1);

You may need to wrap the props with wrapper.setProps

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question