From 61278678ea8a8febee0574cd0f6006492d7b15cb Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Fri, 8 Apr 2022 22:34:24 +0200
Subject: chore: add a AckeeSelect component

---
 .../molecules/forms/ackee-select.test.tsx          | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 src/components/molecules/forms/ackee-select.test.tsx

(limited to 'src/components/molecules/forms/ackee-select.test.tsx')

diff --git a/src/components/molecules/forms/ackee-select.test.tsx b/src/components/molecules/forms/ackee-select.test.tsx
new file mode 100644
index 0000000..e1e6b2d
--- /dev/null
+++ b/src/components/molecules/forms/ackee-select.test.tsx
@@ -0,0 +1,23 @@
+import userEvent from '@testing-library/user-event';
+import { render, screen } from '@test-utils';
+import AckeeSelect from './ackee-select';
+
+describe('Select', () => {
+  it('should correctly set default option', () => {
+    render(<AckeeSelect initialValue="full" />);
+    expect(screen.getByRole('combobox')).toHaveValue('full');
+    expect(screen.queryByRole('combobox')).not.toHaveValue('partial');
+  });
+
+  it('should correctly change value when user choose another option', () => {
+    render(<AckeeSelect initialValue="full" />);
+
+    userEvent.selectOptions(
+      screen.getByRole('combobox'),
+      screen.getByRole('option', { name: 'Partial' })
+    );
+
+    expect(screen.getByRole('combobox')).toHaveValue('partial');
+    expect(screen.queryByRole('combobox')).not.toHaveValue('full');
+  });
+});
-- 
cgit v1.2.3

