import React from 'react';
import { render, cleanup } from '@testing-library/react';
import AuthorTemplateTwo from '.';

describe('AuthorTemplateOne Component', () => {
  it('renders author name in desired format when authorTemplateTwo is false', () => {
    const { container } = render(
      <AuthorTemplateTwo
        label="Written by"
        authorName="John Doe"
        authorPath="/path-to-author"
        verify="../../../../images/verifiedAuthor.svgs"
      />
    );

    expect(container.querySelectorAll('span'));
    expect(container.querySelectorAll('span')).toHaveLength(1);
    expect(container.querySelectorAll('a')).toHaveLength(1);
    expect(container.querySelector('a')).toHaveAttribute('href', '/path-to-author');
  });
});

afterEach(() => {
  cleanup();
});
