4

To test the AgGridReact component, one must wait for the gridReady event as suggested here:

https://www.ag-grid.com/documentation/react/testing/

The suggested method seems to use enzyme (?) to call mount and inspect the component's api property for truthiness.

However, in @testing-library/react, it's not clear that inspecting the internal state of a component is possible; it is certainly discouraged, as discussed here:

https://testing-library.com/docs/react-testing-library/migrate-from-enzyme#why-should-i-use-the-react-testing-library

Because tests seem to require access to the internal state of AG Grid to know when to run a test, and @testing-library/react seems to disallow that access ... is there a way to test components that use AG Grid using @testing-library/react?

Eric
  • 1,414
  • 3
  • 16
  • 35

0 Answers0