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

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

    expect(getByText('Written by John D.')).toBeInTheDocument();
    expect(getByText('Written by John D.')).toHaveAttribute('href', '/path-to-author');
    const link = getByText('Written by John D.');
    expect(link).toBeInTheDocument();
    expect(link).toHaveAttribute('href', '/path-to-author');
  });
});

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