Skip to content
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

Is jest still sufficient to write unit tests for server components ? #19

Open
waqasnoor opened this issue Dec 22, 2020 · 5 comments
Open

Comments

@waqasnoor
Copy link

So i was wondering if we can write unit tests for server side components using just ? since the the return data from server side components when return from server is some complex Object. Maybe we can add few unit tests in this demo project to showcase the uses.

@ashish-r
Copy link

That complex object is the implementation details of the server component, which IMO should not be tested in the unit tests. I think We can test the server components just like the normal functional component, we can assert if some child component is getting rendered or not, and with what props the child components are getting rendered.

@avin-kavish
Copy link

Any way to test async components?

@sibelius
Copy link

yes

@avin-kavish
Copy link

care to elaborate?

@sibelius
Copy link

You can use jest multi projects to have both configs for client and server

like this https://github.com/sibelius/next-jest-multiproject/blob/main/jest.config.js

server components can run in both

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants