aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/organisms/comment/reply-comment-form/reply-comment-form.test.tsx
blob: f02dd4890811181bdffe37bb5a4e4445985f30dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { describe, expect, it } from '@jest/globals';
import { render, screen as rtlScreen } from '../../../../../tests/utils';
import { Heading } from '../../../atoms';
import { ReplyCommentForm } from './reply-comment-form';

describe('ReplyCommentForm', () => {
  it('renders a form with a heading', () => {
    const commentId = 5;
    const heading = 'odio autem voluptas';
    const headingLvl = 3;

    render(
      <ReplyCommentForm
        commentId={commentId}
        heading={<Heading level={headingLvl}>{heading}</Heading>}
      />
    );

    expect(
      rtlScreen.getByRole('heading', { level: headingLvl })
    ).toHaveTextContent(heading);
    expect(rtlScreen.getByRole('form')).toHaveAccessibleName(
      `Leave a reply to comment ${commentId}`
    );
  });
});