import { render, screen } from '@test-utils'; import Comment from './comment'; import { author, data, formattedDate, formattedTime, id, } from './comment.fixture'; describe('Comment', () => { it('renders an avatar', () => { render(); expect( screen.getByRole('img', { name: 'Your name avatar' }) ).toBeInTheDocument(); }); it('renders the author website url', () => { render(); expect(screen.getByRole('link', { name: author.name })).toHaveAttribute( 'href', author.website ); }); it('renders a permalink to the comment', () => { render(); expect( screen.getByRole('link', { name: `${formattedDate} at ${formattedTime}`, }) ).toHaveAttribute('href', `/#comment-${id}`); }); it('renders a reply button', () => { render(); expect(screen.getByRole('button', { name: 'Reply' })).toBeInTheDocument(); }); it('does not render a reply button', () => { render(); expect( screen.queryByRole('button', { name: 'Reply' }) ).not.toBeInTheDocument(); }); });