javascript - Enzyme shallow renderer returns null node element -
i have problem enzyme shallow renderer. wrapper.root.node
returning me null simple div element.
const wrapper = shallow( <div>asd</div> );
and here shallowwrapper object. node element null, unrendered property contains normal rendered object. why ?
shallowwrapper { "complexselector": complexselector { "buildpredicate": [function], "childrenofnode": [function], "findwhereunwrapped": [function], }, "length": 1, "node": null, "nodes": array [ null, ], "options": object {}, "renderer": reactshallowrenderer { "_instance": null, "getrenderoutput": [function], "render": [function], }, "root": [circular], "unrendered": <div> asd </div>, }
ok, problem caused jest 'react-dom' mock :
jest.mock('react-dom')
problem solved moving unit test other file.
Comments
Post a Comment