UNPKG

xchain-components

Version:
26 lines (21 loc) 637 B
/* eslint react/jsx-filename-extension: 0 */ import React from 'react'; import { shallow,mount } from 'enzyme'; import renderer from 'react-test-renderer'; import XButton from '../../XButton'; const clickFn = jest.fn(); describe('XButton', () => { it('should render correctly', () => { const component = shallow(<XButton text="Continue" onButtonClick={clickFn} />); component .find('Button') .simulate('click'); expect(clickFn).toHaveBeenCalled(); }); }); it('renders correctly', () => { const tree = renderer .create(<XButton Text="Continue"/>) .toJSON(); expect(tree).toMatchSnapshot(); });