Skip to content

Instantly share code, notes, and snippets.

@ahuggins
Created January 25, 2019 15:42
Show Gist options
  • Select an option

  • Save ahuggins/ba3ac0a8b377eb97ff85802d72891d86 to your computer and use it in GitHub Desktop.

Select an option

Save ahuggins/ba3ac0a8b377eb97ff85802d72891d86 to your computer and use it in GitHub Desktop.
Use .hostNodes() to see only DOM output
import React from 'react';
import { render, mount, shallow } from 'enzyme';
import { Foo } from 'Foo';
describe.only('Test for Foo component', function () {
it('can mount Foo component', function () {
const wrap = mount(
<Foo />
);
console.log(wrap.find('.someCustomClass').hostNodes().debug());
expect(wrap.find('.someCustomClass').hostNodes()).to.have.length(1);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment