-
Visit
packages\app\screens\device\modals\delete.stories.tsx
notice theuseRouter
mock is commented out. -
Visit
packages\app\utils\hooks\useRouter.mock.ts
notice the export callsmockReturnValue
-
Launch SB, view the story without error.
-
Change the import of
fn
from@vitest/spy
to@storybook/test
-
Notice the story with error
Cannot read properties of undefined (reading 'replace')
This behaviour should not differ in my opinion. To get no error with @storybook/test
add the mockReturnValue
call in packages\app\screens\device\modals\delete.stories.tsx