/**
 * @jest-environment jsdom
 */
import { cleanup, fireEvent, render } from '@testing-library/react';
import React from 'react';
import Rule from '../Rule';

describe('Rule Component - ', () => {
    afterEach(cleanup);
    it('Calls onHide on clicking close button', () => {
        const onHideSpy = jest.fn();
        const { container } = render(<Rule title="EA Rule Title" link="/support/cases" description="Test Rule Render" onHide={onHideSpy} />);
        fireEvent.click(container.querySelector('button.close'));
        expect(onHideSpy.mock.calls.length).toBe(1);
    });
});
