Skip to content
This repository has been archived by the owner. It is now read-only.

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

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

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

brentluna opened this issue Aug 20, 2019 · 1 comment

Comments

@brentluna
Copy link

@brentluna brentluna 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
Copy link
Owner

@kentcdodds kentcdodds commented Aug 27, 2019

Hi @brentluna!

Here's your audio answer.

Loading

@kentcdodds kentcdodds closed this Aug 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants