1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-26 12:29:06 +01:00
metamask-extension/ui/components/app/info-box/info-box.test.js

27 lines
769 B
JavaScript

import React from 'react';
import { fireEvent } from '@testing-library/react';
import { renderWithProvider } from '../../../../test/lib/render-helpers';
import InfoBox from './info-box.component';
describe('InfoBox', () => {
const props = {
title: 'Title',
description: 'Description',
onClose: jest.fn(),
};
it('should match snapshot', () => {
const { container } = renderWithProvider(<InfoBox {...props} />);
expect(container).toMatchSnapshot();
});
it('should call handleClose on info close element', () => {
const { queryByTestId } = renderWithProvider(<InfoBox {...props} />);
const infoBoxClose = queryByTestId('info-box-close');
fireEvent.click(infoBoxClose);
expect(props.onClose).toHaveBeenCalled();
});
});