-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Storybook global mock useDetectOS
and NodeReleasesProvider
#5460
Comments
useDetectOS
and NodeReleasesProvider
useDetectOS
and NodeReleasesProvider
Our App should not have test-specific logic. The testing environments should be able to mock/spy on the real stuff. |
Yeah, in the end we just want to mock the usage of the data within Storybook, so even if the Provider has the real deal, it's fine if the hooks provide the mocked data. |
It seems like I can't use I guess I'll try to find a workaround or maybe figuring out why it doesn't work in the first place... |
What doesn't work in the first place? We can also have a fake App Tree within the The App Tree for Storybook should be as simple as possible. I would even argue that the Theming we have (switch from dark to light) should not be done via |
Sorry for the confusion
Initially I wanted to mock the modules for only snapshots testing (and having Storybook running using real data). I just remembered Harkunwar's |
Yeah, to be fair, I still would argue we shouldn't import the whole Base App tree on Storybooks (https://github.com/nodejs/nodejs.org/blob/main/.storybook/preview.tsx#L30), the idea initially was of course to the Stories to be as close as the real, App. But thinking it through we have a couple of issues:
I'm going to make a quick-pr making some changes that should ease your work. |
@HinataKah0 let me know if you need help here :) |
FYI @HinataKah0 do you have any progress here? I assume the |
Note that based on the new Figma's our
|
I tried mocking the And mocking for unit tests here (in the same PR). I've been putting the PR on hold due to the new design. And the issue has been closed as well. Since some time has passed, I want to validate my understanding again (it's very easy to miscommunicate). From what I understood, I think we previously agreed on mocking the |
Do we need this anymore? |
Enter your suggestions in details:
NodeReleasesProvider
is used in Storybook now. However, it is reading from generatedpublic/node-releases-data.json
file now.https://github.com/nodejs/nodejs.org/blob/main/next.app.tsx#L30-L34
And similarly with
useDetectOS
hook, it will detect your PC/laptop's OS and use it for generating the Storybook snapshots.See this generated snapshot.
Notice that the Mac's
DownloadCard
is havingdownloadCardActive
class:I think we need a global mock since many components depend on Node releases data and user OS information.
The text was updated successfully, but these errors were encountered: