import React from 'react';

import CookieDisclaimer from './index';

const mockCallback = jest.fn();
const data = {
  text: 'text',
  readMoreLinkUrl: 'readMoreLinkUrl',
  readMoreLinkText: 'readMoreLinkText',
  buttonCtaText: 'buttonCtaText',
  setIsOpen: mockCallback,
  isOpen: true,
};

describe('CookieDisclaimer', () => {
  const defaultElement = <CookieDisclaimer {...data} />;
  let wrapper;

  beforeEach(() => {
    wrapper = shallow(defaultElement);
  });

  it('should render correctly', () => {
    expect(wrapper).toMatchSnapshot();
  });

  it('should fire onClick event', () => {
    wrapper
      .find('Button')
      .dive()
      .find('button')
      .simulate('click');
    expect(mockCallback.mock.calls.length).toBe(1);
  });
});
