Mocking a utility function that uses next/header cookie #31207
Unanswered
alasdair009
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
I am running a Next Multi-tenant site that uses cookies to store the context of the currently viewed tenant so that any shared server components can call the following to style themselves or change their behaviour as applicable:
This works fine inside the Next app, but Storybook cannot use next/headers in stories so I created a mock implementation...
I then updated the
main.ts
file inside.storybook
to:However, when the component in question loads, it still appears to run the original function and return
default
.I even tried mocking inline on the story with...
Am I missing something here?
Additional information
Storybook: 8.6.12
Create a reproduction
No response
Beta Was this translation helpful? Give feedback.
All reactions