Wrap next/navigation
mock with fn
.
#26292
hayato-osh
started this conversation in
Ideas
Replies: 2 comments 5 replies
-
@yannbf, does your work regarding improved support of Next.js for portable stories fix this? |
Beta Was this translation helpful? Give feedback.
1 reply
-
@hayato-osh Working on a proposal where you can do: const defaultNavigationContext = {
push: fn().mockName('nextNavigation.push'),
}; And it will be logged in the action panel automatically. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is your feature request related to a problem? Please describe.
LT;DR
I would like to see support for spying
next/navigation
andnext/router
in the play function.Problem
next/navigation
andnext/router
are mocked up according to the following documentation.https://www.npmjs.com/package/@storybook/nextjs/v/0.0.0-pr-24604-sha-a206c3eb#default-navigation-context
However, this mock does not allow spying with the play function.
As a workaround, each function can be tested by wrapping it with
fn
as shown below:Describe the solution you'd like
I believe Storybook is currently focusing on testing functionality, so I would like to see this supported by default.
Describe alternatives you've considered
No response
Are you able to assist to bring the feature to reality?
yes, I can
Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions