These are chat archives for airbnb/enzyme

Jun 2017
Sean Matheson
Jun 21 2017 10:06

Hey all I am trying to assert against an element that is provided as a prop to a component.

function ComponentUnderTest() {
   const foo = <span>👋</span>
   return <Bob something={foo} />

I have tried doing something like:

shallow(<ComponentUnderTest />)

But I just get (0 , _enzyme.shallow)(...).prop(...).matchesElement is not a function
Any ideas?

Sean Matheson
Jun 21 2017 10:15
It’s like I need to lift the something prop value into the enzyme wrapper API
Jordan Harband
Jun 21 2017 16:05
@ctrlplusb there's no easy way to do that. you'd have to wrap the prop value in a div and shallow render it first.
Sean Matheson
Jun 21 2017 16:11
@ljharb thanks for tip 👍