Skip to content

Instantly share code, notes, and snippets.

@takahirohonda
Created April 23, 2021 23:33
Show Gist options
  • Save takahirohonda/667158d2f2e3178bbfe24b78a7e201ff to your computer and use it in GitHub Desktop.
Save takahirohonda/667158d2f2e3178bbfe24b78a7e201ff to your computer and use it in GitHub Desktop.
wrapper-test.jsx
import React from 'react';
import { mount, shallow } from 'enzyme';
import Wrapper from '.';
describe('<Wrapper />', () => {
test('renders with correct className with mount', () => {
const wrapper = mount(<Wrapper>Children here</Wrapper>);
console.log(wrapper.debug());
expect(wrapper.find('div').hasClass('wrapper')).toBeTruthy();
});
test('renders with correct className with shallow', () => {
const wrapper = shallow(<Wrapper>Children here</Wrapper>);
console.log(wrapper.debug());
expect(wrapper.hasClass('wrapper')).toBeTruthy();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment