enzyme hasclass example
// dom.js
import React from 'react'
const DomTest = () => (
<div>
<h1 className='header'>
<span className='sub-header'>Hello World</span>
</h1>
</div>
)
export default DomTest
// dom.test.js
test('find element in DomTest Component by class using hasClass', () => {
expect(wrapper.find('h1').hasClass('header')).toBeTruthy()
expect(wrapper.find('h1 > span').at(0).hasClass('sub-header')).toBeTruthy()
expect(wrapper.find('h1').children().find('span').hasClass('sub-header')).toBeTruthy()
expect(wrapper.find('h1').children().at(0).hasClass('sub-header')).toBeTruthy()
expect(wrapper.find('h1').childAt(0).hasClass('sub-header')).toBeTruthy()
})