Thomas John
Thomas John

Reputation: 2188

how to test an attribute's attribute of an object type prop in enzyme?

This is what my jsx file contains, {' '+this.props.file.attached.name} How can I write test for this name ?

Upvotes: 2

Views: 337

Answers (1)

Thomas John
Thomas John

Reputation: 2188

expect(wrapper.containsMatchingElement([<div class="attachedFile"><i class="fa fa-file-image-o"></i>  apple</div>])).to.equal(true);

This works perfect,ensure that you surround the elements with []

Upvotes: 1

Related Questions