Skip to content

Doubt about no-render-in-setup #520

Closed Answered by Belco90
iiLearner asked this question in Q&A
Discussion options

You must be logged in to vote

Hi! The idea behind this rule is to render the elements as close as possible to your tests, so you render them inside each test in the "arrange" step.

This is also a good way to encourage merging several assertions into the same test so you render once in a test and then assert as much as possible. This doesn't mean you must have a single test to check everything, but will help you trying to write less unit tests and more integration ones.

Additionally, this helps avoiding weird workarounds when you need a different fixture/scenario setup before rendering when the render is located in some before* hook.

You can find a bit more in the original issue: #207

Perhaps we should update the rule …

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by MichaelDeBoey
Comment options

You must be logged in to vote
1 reply
@Belco90
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants