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

React Testing Library - FactoryBot like mocks for global state? #732

Closed
brentluna opened this issue Aug 20, 2019 · 1 comment

Comments

@brentluna
Copy link

commented Aug 20, 2019

So my react testing is limited, most of my testing experience has been backend unit testing. Our App uses MobX, and there are a couple instances of MobX stores(in the form of es6 class instances), UserStore and MasterStore, that contain a lot of access control logic. So when testing components often I want to test that something is visible or not for a certain user. My previous testing experienced used FactoryBot in rails to create Factorys that would generate variety's of an object instance(AdminFactory, ViewerFactory, ...etc). Is there an approach you recommend for handling this when using RTL?

Thank ou

@kentcdodds

This comment has been minimized.

Copy link
Owner

commented Aug 27, 2019

Hi @brentluna!

Here's your audio answer.

@kentcdodds kentcdodds closed this Aug 27, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.