From a6ff5eee45215effb3344cb5d631a27a7c0369aa Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Fri, 22 Sep 2023 19:34:01 +0200
Subject: refactor(components): rewrite form components

---
 .../forms/contact-form/contact-form.test.tsx       | 48 ++++++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 src/components/organisms/forms/contact-form/contact-form.test.tsx

(limited to 'src/components/organisms/forms/contact-form/contact-form.test.tsx')

diff --git a/src/components/organisms/forms/contact-form/contact-form.test.tsx b/src/components/organisms/forms/contact-form/contact-form.test.tsx
new file mode 100644
index 0000000..59d69fa
--- /dev/null
+++ b/src/components/organisms/forms/contact-form/contact-form.test.tsx
@@ -0,0 +1,48 @@
+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();
+  });
+});
-- 
cgit v1.2.3

