You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Components that rely on a Cart Context cannot be rendered in Storybook. This error is shown:
Error: Expected a Cart Context, but no Cart Context was found
CartTestProviders already exists as a mock Provider which could resolve this, but it isn't exported by @shopify/hydrogen/testing.
To Reproduce
Add Storybook to a Hydrogen project (v1.5.0 and above)
Create a story rendering the Header.client component from the Hydrogen demo store (or any component that uses the useCart hook and relies on a Cart Context)
Run storybook and try to load the story
Expected behaviour
I should be able to import CartTestProviders from @shopify/hydrogen/testing and use this in a decorator to provide Cart Context (the same way I can with ShopifyTestProviders). Component should render in Storybook without errors.
Screenshots
Additional context
Hydrogen version: 1.5.0+
The text was updated successfully, but these errors were encountered:
Describe the bug
Components that rely on a Cart Context cannot be rendered in Storybook. This error is shown:
CartTestProviders
already exists as a mock Provider which could resolve this, but it isn't exported by @shopify/hydrogen/testing.To Reproduce
useCart
hook and relies on a Cart Context)Expected behaviour
I should be able to import
CartTestProviders
from @shopify/hydrogen/testing and use this in a decorator to provide Cart Context (the same way I can withShopifyTestProviders
). Component should render in Storybook without errors.Screenshots
Additional context
The text was updated successfully, but these errors were encountered: