From fb29b0f017fae162ffa7ad6bdfc80099346802de Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Mon, 13 Nov 2023 19:03:44 +0100
Subject: refactor(components): replace SocialMedia with SocialMediaWidget

* the goal is to make the name of the widgets coherent
* remove useless CSS
* replace Media type with SocialMediaData
---
 .../social-media-widget.test.tsx                   | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 src/components/organisms/widgets/social-media-widget/social-media-widget.test.tsx

(limited to 'src/components/organisms/widgets/social-media-widget/social-media-widget.test.tsx')

diff --git a/src/components/organisms/widgets/social-media-widget/social-media-widget.test.tsx b/src/components/organisms/widgets/social-media-widget/social-media-widget.test.tsx
new file mode 100644
index 0000000..197b9ac
--- /dev/null
+++ b/src/components/organisms/widgets/social-media-widget/social-media-widget.test.tsx
@@ -0,0 +1,27 @@
+import { describe, expect, it } from '@jest/globals';
+import { render, screen as rtlScreen } from '@testing-library/react';
+import { Heading } from '../../../atoms';
+import { type SocialMediaData, SocialMediaWidget } from './social-media-widget';
+
+describe('SocialMediaWidget', () => {
+  it('render the widget heading and a list of social media', () => {
+    const heading = 'aut dolorem molestiae';
+    const headingLvl = 3;
+    const media = [
+      { icon: 'Github', id: 'github', label: 'Github', url: '#github' },
+      { icon: 'LinkedIn', id: 'linkedin', label: 'LinkedIn', url: '#linkedin' },
+    ] satisfies SocialMediaData[];
+
+    render(
+      <SocialMediaWidget
+        heading={<Heading level={headingLvl}>{heading}</Heading>}
+        media={media}
+      />
+    );
+
+    expect(
+      rtlScreen.getByRole('heading', { level: headingLvl })
+    ).toHaveTextContent(heading);
+    expect(rtlScreen.getAllByRole('link')).toHaveLength(media.length);
+  });
+});
-- 
cgit v1.2.3

