aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/organisms/forms/contact-form/contact-form.test.tsx
blob: d788e0921816a9ab4f41ae9c53028757bb045628 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { describe, expect, it } from '@jest/globals';
import { render, screen } from '../../../../../tests/utils';
import { ContactForm } from './contact-form';

const props = {
  sendMail: async () => {
    /** Do nothing. */
  },
};

describe('ContactForm', () => {
  it('renders a contact form', () => {
    render(<ContactForm {...props} />);
    expect(
      screen.getByRole('form', { name: 'Contact form' })
    ).toBeInTheDocument();
  });

  it('renders a name field', () => {
    render(<ContactForm {...props} />);
    expect(screen.getByRole('textbox', { name: /^Name:/ })).toBeInTheDocument();
  });

  it('renders an email field', () => {
    render(<ContactForm {...props} />);
    expect(
      screen.getByRole('textbox', { name: /^Email:/ })
    ).toBeInTheDocument();
  });

  it('renders an object field', () => {
    render(<ContactForm {...props} />);
    expect(
      screen.getByRole('textbox', { name: /^Object:/ })
    ).toBeInTheDocument();
  });

  it('renders a message field', () => {
    render(<ContactForm {...props} />);
    expect(
      screen.getByRole('textbox', { name: /^Message:/ })
    ).toBeInTheDocument();
  });

  it('renders a submit button', () => {
    render(<ContactForm {...props} />);
    expect(screen.getByRole('button', { name: /^Send/ })).toBeInTheDocument();
  });
});