1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-24 02:58:09 +01:00
metamask-extension/ui/components/app/info-box/info-box.test.js

36 lines
872 B
JavaScript
Raw Normal View History

import React from 'react';
import sinon from 'sinon';
import { shallow } from 'enzyme';
import InfoBox from './info-box.component';
describe('InfoBox', () => {
let wrapper;
const props = {
title: 'Title',
description: 'Description',
onClose: sinon.spy(),
};
beforeEach(() => {
wrapper = shallow(<InfoBox {...props} />);
});
it('renders title from props', () => {
const title = wrapper.find('.info-box__title');
expect(title.text()).toStrictEqual(props.title);
});
it('renders description from props', () => {
const description = wrapper.find('.info-box__description');
expect(description.text()).toStrictEqual(props.description);
});
it('closes info box', () => {
const close = wrapper.find('.info-box__close');
close.simulate('click');
expect(props.onClose.calledOnce).toStrictEqual(true);
});
});