aws / graph-explorer

React-based web application that enables users to visualize both property graph and RDF data and explore connections between data without having to write graph queries.
https://github.com/aws/graph-explorer
Apache License 2.0
317 stars 47 forks source link

Improve testing with Recoil state #421

Closed kmcginnes closed 4 months ago

kmcginnes commented 4 months ago

Description

Testing hooks with Recoil state was mocking hooks like useConfiguration() before. I want to actually execute all the logic within the Recoil selectors since so much of our logic is hidden in there.

So I've created a helper to make these tests easier to write. Using renderHookWithRecoilRoot() we are now able to wrap the hook call and provide an initial state setup function. This removes the need for mocks and allows this code to execute the full stack of recoil logic.

Validation

I focused on only change test setup and config. No logic changed. No test expectations changed.

Related Issues

Check List