These are chat archives for
Sign in to start talking
Nov 08 2017 11:40
I don't really understand the point of shallow rendering, I want to test the actual DOM that gets generated. I don't care what components the unit under test calls out to
why do you need to check the name?
can't you just use an eslint plugin that enforces a displayName?
Nov 08 2017 18:32
shallow rendering has the
like 99% of your tests should be solely shallow-rendered
the actual DOM that gets generated isn't important; testing that is testing react itself - and you're not react
what's important is what react elements each of your components renders
you're supposed to trust that react converts that to HTML properly.
Nov 08 2017 19:37
But what happens if I refactor the component? I want to assert that the behaviour hasn't changed
Nov 08 2017 19:41
and what kind of refactor
so let's say you move things into separate components
those things get shallow unit tested fully
now, all you need to do is modify your component tests to assert, in its shallow render, that instead of rendering a div with some stuff, it renders a SpecialDiv component with the right props
shallow-rendering lets your tests explicitly delegate testing responsibility to the tests of other components