* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import * as React from 'react';
import { mockBranch, mockPullRequest } from '../../../helpers/mocks/branch-like';
import BranchLikeIcon, { BranchLikeIconProps } from '../BranchLikeIcon';
it('should render branch icon correctly', () => {
- const wrapper = shallowRender({ branchLike: mockBranch() });
- expect(wrapper).toMatchSnapshot();
+ renderBranchLikeIcon({ branchLike: mockBranch() });
+ expect(document.body.innerHTML).toMatchSnapshot();
});
it('should render pull request icon correctly', () => {
- const wrapper = shallowRender({ branchLike: mockPullRequest() });
- expect(wrapper).toMatchSnapshot();
+ renderBranchLikeIcon({ branchLike: mockPullRequest() });
+ expect(document.body.innerHTML).toMatchSnapshot();
});
-function shallowRender(props: BranchLikeIconProps) {
- return shallow(<BranchLikeIcon {...props} />);
+function renderBranchLikeIcon(props: BranchLikeIconProps) {
+ return render(<BranchLikeIcon {...props} />);
}
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import * as React from 'react';
import Icon, { IconProps } from '../Icon';
it('should render correctly', () => {
- expect(shallowRender()).toMatchSnapshot();
+ renderIcon();
+ expect(document.body.innerHTML).toMatchSnapshot();
});
-function shallowRender(props: Partial<IconProps> = {}) {
- return shallow(
+function renderIcon(props: Partial<IconProps> = {}) {
+ return render(
<Icon {...props}>
<path d="test-path" />
</Icon>
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`should render branch icon correctly 1`] = `<BranchIcon />`;
+exports[`should render branch icon correctly 1`] = `"<div><svg height=\\"16\\" style=\\"fill-rule: evenodd; clip-rule: evenodd; stroke-linejoin: round; stroke-miterlimit: 1.41421;\\" version=\\"1.1\\" viewBox=\\"0 0 16 16\\" width=\\"16\\" xmlns:xlink=\\"http://www.w3.org/1999/xlink\\" xml:space=\\"preserve\\"><path d=\\"M12.5 6.5c0-1.1-.9-2-2-2s-2 .9-2 2c0 .8.5 1.5 1.2 1.8-.3.6-.7 1.1-1.2 1.4-.9.5-1.9.5-2.5.4V4c.9-.2 1.5-1 1.5-1.9 0-1.1-.9-2-2-2s-2 .9-2 2C3.5 3 4.1 3.8 5 4v8c-.9.2-1.5 1-1.5 1.9 0 1.1.9 2 2 2s2-.9 2-2c0-.9-.6-1.7-1.5-1.9v-1c.2 0 .5.1.7.1.7 0 1.5-.1 2.2-.6.8-.5 1.4-1.2 1.7-2.1 1.1 0 1.9-.9 1.9-1.9zm-8-4.4c0-.6.4-1 1-1s1 .4 1 1-.4 1-1 1-1-.5-1-1zm2 11.9c0 .6-.4 1-1 1s-1-.4-1-1 .4-1 1-1 1 .4 1 1zm4-6.5c-.6 0-1-.4-1-1s.4-1 1-1 1 .4 1 1-.4 1-1 1z\\" style=\\"fill: #236a97;\\"></path></svg></div>"`;
-exports[`should render pull request icon correctly 1`] = `<PullRequestIcon />`;
+exports[`should render pull request icon correctly 1`] = `"<div><svg height=\\"16\\" style=\\"fill-rule: evenodd; clip-rule: evenodd; stroke-linejoin: round; stroke-miterlimit: 1.41421;\\" version=\\"1.1\\" viewBox=\\"0 0 16 16\\" width=\\"16\\" xmlns:xlink=\\"http://www.w3.org/1999/xlink\\" xml:space=\\"preserve\\"><path d=\\"M13,11.9L13,5.5C13,5.4 13.232,1.996 7.9,2L9.1,0.8L8.5,0.1L5.9,2.6L8.5,5.1L9.2,4.4L7.905,3.008C12.256,2.99 12,5.4 12,5.5L12,11.9C11.1,12.1 10.5,12.9 10.5,13.8C10.5,14.9 11.4,15.8 12.5,15.8C13.6,15.8 14.5,14.9 14.5,13.8C14.5,12.9 13.9,12.2 13,11.9ZM4,11.9C4.9,12.2 5.5,12.9 5.5,13.8C5.5,14.9 4.6,15.8 3.5,15.8C2.4,15.8 1.5,14.9 1.5,13.8C1.5,12.9 2.1,12.1 3,11.9L3,4.1C2.1,3.9 1.5,3.1 1.5,2.2C1.5,1.1 2.4,0.2 3.5,0.2C4.6,0.2 5.5,1.1 5.5,2.2C5.5,3.1 4.9,3.9 4,4.1L4,11.9ZM12.5,14.9C11.9,14.9 11.5,14.5 11.5,13.9C11.5,13.3 11.9,12.9 12.5,12.9C13.1,12.9 13.5,13.3 13.5,13.9C13.5,14.5 13.1,14.9 12.5,14.9ZM3.5,14.9C2.9,14.9 2.5,14.5 2.5,13.9C2.5,13.3 2.9,12.9 3.5,12.9C4.1,12.9 4.5,13.3 4.5,13.9C4.5,14.5 4.1,14.9 3.5,14.9ZM2.5,2.2C2.5,1.6 2.9,1.2 3.5,1.2C4.1,1.2 4.5,1.6 4.5,2.2C4.5,2.8 4.1,3.2 3.5,3.2C2.9,3.2 2.5,2.8 2.5,2.2Z\\" style=\\"fill: #236a97;\\"></path></svg></div>"`;