News for hackers. Stuff that matters.
Re:Idiomatic React Testing Patterns by shepmaster on Wednesday July 13, 2016 @01:53PM (#12088194)
Do you use any tools to make the assertions on the resulting DOM simpler?

What about any components that maintain internal state; do you just step them through the states and assert the DOM state as well?

Re:Idiomatic React Testing Patterns by cjcenizal on Wednesday July 13, 2016 @02:58PM (#12088707)
I built this testing tool at a previous employer: https://github.com/smaato/react-test-kit. It's very very simple, it just exposes jQuery-like methods for querying the DOM (and internally uses Sizzle).

Here's an example of how we used react-test-kit to test a SearchBox component: https://github.com/smaato/ui-framework/blob/develop/src/fram...

Here's the interactive component example: http://smaato.github.io/ui-framework/#/searchbox

Re:Idiomatic React Testing Patterns by analyst74 on Wednesday July 13, 2016 @03:00PM (#12088725)
I find it simplest to use shallow rendering in my unit tests as opposed to rendering the DOM, so the output I have to verify only contains things the component-under-test renders.

As for shallow render, you can use either the default Test Utilities or Enzyme, I personally find Enzyme's shallow render implementation much easier to work with.