Skip to content

Lazy user event setup call #1052

Answered by ph-fritsche
bpinto asked this question in Q&A
Sep 6, 2022 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

We recommend invoking userEvent.setup() before the component is rendered.

You could add user on a different function. E.g. in our own tests we have a render function without user and a setup function that adds user.

But if it's for avoiding an unnecessary invocation, it's probably not worth the extra choice for the test author.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@bpinto
Comment options

@ph-fritsche
Comment options

Answer selected by bpinto
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