{"version":"1.0","type":"rich","title":"Idiomatic React Testing Patterns","description":"This example demonstrates four idiomatic patterns for testing React components, organized by purity: basic rendering, stateless interactions, stateful interactions, and instance methods. It shows how to structure test setup with a `getComponent` helper that provides default props while allowing per-test overrides. The code uses Mocha, Chai, Sinon, React’s `TestUtils.renderIntoDocument`, `ReactDOM.render`, and `ReactDOM.findDOMNode` to render components and simulate user events, with re-rendering for stateful cases. The patterns cover asserting prop-driven output, callback invocation, state changes, and direct method calls.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-67ca493f9c88939fb8b49c30c2857a21?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}