Closed wezter96 closed 1 year ago
I'm having a similar issue while trying to use a dripsy component in a Storybook story:
TypeError: Cannot read properties of null (reading 'theme')
at Wrapped (create-themed-component.tsx:1:1)
Were you ever able to figure out what was needed here?
Also having this issue 😢
That error indicates that the provider isn’t present above in the component tree…
@nandorojo , you rock. With your comment, it took me all of 30 seconds to figure it out and create a decorator to wrap my Storybook stories with the Dripsy component. Hot reloaded and that was that.
For the jest issue above, I think you'd pretty much want the same thing. Probably something like,
const renderWithDripsy = (component) => render(<Dripsy>{component}</Dripsy>)
@nandorojo Woooo I feel dumb haha thanks!
🤝
Do you have any suggestions on what should be done regarding mocking and such with dripsy in unit tests?
I have tests that seem to fail because of theme not being defined and if I mocked that then I got the same issues regarding styled. TypeError: Cannot read properties of null (reading 'theme') and if I mock my theme I get: TypeError: (0 , _dripsy.styled)(...) is not a function