import React from 'react';
import { shallow } from 'enzyme';
import ArtistPopoverDigital, { Props } from '../artistPopoverDigital';

describe('<ArtistPopoverDigital>', () => {
    const defaultProps = {
        id: 'Test',
        profiles: [{ name: 'Lost Highway' }],
        isLoading: false,
        onEditIncorrectArtist: jest.fn(),
        onOpen: jest.fn(),
    };

    const renderComponent = (props?: Partial<Props>) =>
        shallow(
            <ArtistPopoverDigital {...defaultProps} {...props}>
                <span>Content</span>
            </ArtistPopoverDigital>
        );

    beforeEach(() => {
        defaultProps.onEditIncorrectArtist = jest.fn();
        defaultProps.onOpen = jest.fn();
    });

    describe('when it renders', () => {
        it('displays correct layout', () => {
            expect(renderComponent()).toMatchSnapshot();
        });
        it('displays layout without footer', () => {
            const component = renderComponent({
                onEditIncorrectArtist: undefined,
            });
            expect(component.find('ArtistPopover').prop('footer')).toBeNull();
        });
    });
});
