Enzyme `wrappingComponent` doesn't work
Closed this issue · 2 comments
princed commented
This recommended form for enzyme doesn't actually work for some reason:
const container = mount(<MyComponent />, {
wrappingComponent: DiProvider,
wrappingComponentProps: { use: [ModalOpen, useQuery] },
});
No errors, the context is just not provided.
Works okay if you do this though:
const container = mount(
<DiProvider use={[ModalOpen, useQuery]}>
<MyComponent />
</DiProvider>
);
albertogasparin commented
Thank you for trying it out. I had that API in mind but didn't wrote actual code to test it out, so probably there was a bug somewhere.
I've now published v2.0.1 and added examples for this pattern in unit tests and I see it working fine.
Can you try it out again and let me know?
PS: different case for shallow
, where Enzyme does not support useContext
properly 😞
princed commented
Yes, it seems to be working now! Thank you Alberto!