crane-cloud/frontend

View on GitHub
src/components/CancelButton/CancelButton.test.jsx

Summary

Maintainability
A
0 mins
Test Coverage
import React from 'react';

import { shallow } from 'enzyme';

import CancelButton from './index';

describe('Button Component', () => {
  it('Renders a button component', () => {

    const buttonEvent = jest.fn();
    const ButtonComponent = shallow(<CancelButton buttonClass="CancelButton" onClick={buttonEvent} />);
    expect(ButtonComponent.find('.CancelButton').hasClass('CancelButton')).toBe(true);

    ButtonComponent.find('.CancelButton').simulate('click');
    expect(buttonEvent).toHaveBeenCalled();
  });
});