From 0e52a59917406ad03c174e030c6c1c92ab23449d Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Mon, 30 Oct 2023 12:44:11 +0100
Subject: refactor(components): extract SettingsForm component form
 SettingsModal

We could use an array of items and map over it instead of repeating the
Switch component for each settings but with translations, it becomes
quickly unreadable. So I prefer to keep separate components.
---
 .../ackee-toggle/ackee-toggle.test.tsx             | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 src/components/organisms/forms/settings-form/ackee-toggle/ackee-toggle.test.tsx

(limited to 'src/components/organisms/forms/settings-form/ackee-toggle/ackee-toggle.test.tsx')

diff --git a/src/components/organisms/forms/settings-form/ackee-toggle/ackee-toggle.test.tsx b/src/components/organisms/forms/settings-form/ackee-toggle/ackee-toggle.test.tsx
new file mode 100644
index 0000000..30bbf3a
--- /dev/null
+++ b/src/components/organisms/forms/settings-form/ackee-toggle/ackee-toggle.test.tsx
@@ -0,0 +1,28 @@
+import { describe, expect, it } from '@jest/globals';
+import { render, screen as rtlScreen } from '../../../../../../tests/utils';
+import { AckeeProvider } from '../../../../../utils/providers';
+import { AckeeToggle } from './ackee-toggle';
+
+describe('AckeeToggle', () => {
+  it('renders a radio group of two radio buttons', () => {
+    const defaultValue = 'full';
+
+    render(
+      <AckeeProvider
+        domainId="any-id"
+        server="https://example.com"
+        storageKey="molestiae"
+        tracking={defaultValue}
+      >
+        <AckeeToggle />
+      </AckeeProvider>
+    );
+
+    expect(
+      rtlScreen.getByRole('radiogroup', {
+        name: /Tracking:/i,
+      })
+    ).toBeInTheDocument();
+    expect(rtlScreen.getAllByRole('radio')).toHaveLength(2);
+  });
+});
-- 
cgit v1.2.3

