Enzyme: Testing render method

Created on 1 Oct 2018  路  14Comments  路  Source: enzymejs/enzyme

Need To Reproduce bug package 15

All 14 comments

const wrapper = shallow(<TitleContainer />);
expect(wrapper.find(SubmitAppFormContainer)).to.have.lengthOf(0);

You can't really test anything else, since "isPageEnabled" is never anything but false in your code.

If it's a prop, absolutely. You have it marked as "private".

The first one is a typescript error and is unrelated to enzyme; the second one is troubling and might reflect a real bug in enzyme.

Can you confirm that the code in the OP matches the exact code in the TitleContainer component?

Also, which exact version of enzyme, react, and the react 15 adapter are you using? Can you include the code inside UserRoles?

So in that error, what is on line 38 of UserRoles.test.tsx?

and while I have you, if you delete the connect wrapper, and also delete all the methods but render in TitleContainer, do you get the same issue?

no, i mean in the actual implementation of TitleContainer - reduce it down to just what you have in the OP.

Thanks - I'm having trouble reproducing this; can you try updating to enzyme-adapter-react-15 v1.1, and enzyme v3.6?

If you set them to true before creating the wrapper, yes.

In your case, where you've declared "private" (altho fully public) own properties, you're right - you'd need to alter them, and then wrapper.update(), and then you'd be able to wrapper.find.

It seems right to me.

I'm not sure how to proceed here. Is there any chance you could make a small repo that can reproduce the problem, so I can clone it myself? That way I can much more easily figure out exactly what is wrong.

Note that npm ls has to exit successfully, otherwise your dependency graph is invalid, and nothing can be expected to work.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

abe903 picture abe903  路  3Comments

dschinkel picture dschinkel  路  3Comments

rexonms picture rexonms  路  3Comments

aweary picture aweary  路  3Comments

modemuser picture modemuser  路  3Comments