When writing tests for React components, you must map them to the DOM in order to make statements about their correctness. For example, if you want to check that a certain class has been added to a node with a certain status, you must make it in the DOM node and then check the DOM node through the regular DOM API.
The fact is, given that React supports the virtual DOM, into which it maps, why can't we just claim on the virtual DOM after rendering the component? It seems to me that this is a very good reason to have something like a virtual DOM.
Did I miss something?
javascript dom unit-testing reactjs jestjs
Tom
source share