Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
React Testing Library - FactoryBot like mocks for global state? #732
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?