import * as React from 'react';
import {act, fireEvent, render} from '../../test-utils';
import Logo from '../Logo';
import { NavigationProvider } from '../../Navigation';

describe('Logo', () => {

  const navProps = {
    currentPath: '',
    isActiveRoute: () => false,
    navigate: (path: string, isExternal: boolean) => {}
  };

  it('should render beta tag', () => {
    const wrapper = render(<NavigationProvider {...navProps}><Logo name={'name'} showBetaTag={true}/></NavigationProvider>);

    expect(wrapper.getByText('BETA')).toBeDefined();
  });

  it('should call onClick when logo is clicked', () => {
    const onClickSpy = jest.fn();
    const wrapper = render(<NavigationProvider {...navProps}><Logo name={'name'} onClick={onClickSpy}/></NavigationProvider>);

    act(() => {
      fireEvent.click(wrapper.container.querySelector('a')!);
    });

    expect(onClickSpy).toHaveBeenCalled();
  });

});
