Skip to content
Snippets Groups Projects
Commit 9cf0d605 authored by Jack Reed's avatar Jack Reed
Browse files

Backfill CollectionInfo test

parent a49e8922
No related branches found
No related tags found
No related merge requests found
import React from 'react';
import { shallow } from 'enzyme';
import Button from '@material-ui/core/Button';
import { CollectionInfo } from '../../../src/components/CollectionInfo';
import CollapsibleSection from '../../../src/containers/CollapsibleSection';
/** */
function createWrapper(props) {
return shallow(
<CollectionInfo
id="test"
collectionPath={[1, 2]}
showCollectionDialog={() => {}}
{...props}
/>,
);
}
describe('CollectionInfo', () => {
it('renders a collapsible section', () => {
const wrapper = createWrapper();
expect(wrapper.find(CollapsibleSection).length).toEqual(1);
});
it('without a collectionPath, renders nothing', () => {
const wrapper = createWrapper({ collectionPath: [] });
expect(wrapper.find(CollapsibleSection).length).toEqual(0);
});
it('clicking the button fires showCollectionDialog', () => {
const showCollectionDialog = jest.fn();
const wrapper = createWrapper({ showCollectionDialog });
expect(wrapper.find(Button).first().simulate('click'));
expect(showCollectionDialog).toHaveBeenCalled();
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment