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.
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.
Update Jest config to enable TSX transpiling and use more defaults
Add renderHookWithRecoilRoot()
Add new random data generator for RawConfiguration
Use initial recoil state instead of mocking for many tests
Uninstall jest-localstorage-mock since it was no longer used
Validation
I focused on only change test setup and config. No logic changed. No test expectations changed.
Run the tests
Related Issues
Part of #341
Part of #339
Check List
[x] I confirm that my contribution is made under the terms of the Apache 2.0
license.
[x] I have run pnpm checks to ensure code compiles and meets standards.
[x] I have run pnpm test to check if all tests are passing.
[x] I have covered new added functionality with unit tests if necessary.
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.renderHookWithRecoilRoot()
RawConfiguration
jest-localstorage-mock
since it was no longer usedValidation
I focused on only change test setup and config. No logic changed. No test expectations changed.
Related Issues
Check List
pnpm checks
to ensure code compiles and meets standards.pnpm test
to check if all tests are passing.Changelog.md
.