summaryrefslogtreecommitdiffstats
path: root/src/components/organisms/widgets/social-media.test.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-04-15 17:38:16 +0200
committerArmand Philippot <git@armandphilippot.com>2022-04-15 17:42:28 +0200
commitb3ac82bba9605fa9d9c4b1d29c5a56a52e9de015 (patch)
tree1d3d9dcd6993f7b5ebf04218d57670dc751a239d /src/components/organisms/widgets/social-media.test.tsx
parenta07729064790df13324dbe7f4d1629892070558b (diff)
chore: add a SocialMedia component
Diffstat (limited to 'src/components/organisms/widgets/social-media.test.tsx')
-rw-r--r--src/components/organisms/widgets/social-media.test.tsx33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/components/organisms/widgets/social-media.test.tsx b/src/components/organisms/widgets/social-media.test.tsx
new file mode 100644
index 0000000..e40db30
--- /dev/null
+++ b/src/components/organisms/widgets/social-media.test.tsx
@@ -0,0 +1,33 @@
+import { render, screen } from '@test-utils';
+import SocialMedia, { Media } from './social-media';
+
+const media: Media[] = [
+ { name: 'Github', url: '#' },
+ { name: 'LinkedIn', url: '#' },
+];
+const title = 'Dolores ut ut';
+const titleLevel = 2;
+
+/**
+ * Next.js mock images with next/image component. So for now, I need to mock
+ * the svg files manually.
+ */
+jest.mock('@assets/images/social-media/github.svg', () => 'svg-file');
+jest.mock('@assets/images/social-media/linkedin.svg', () => 'svg-file');
+
+describe('SocialMedia', () => {
+ it('renders the widget title', () => {
+ render(<SocialMedia media={media} title={title} level={titleLevel} />);
+ expect(
+ screen.getByRole('heading', {
+ level: titleLevel,
+ name: new RegExp(title, 'i'),
+ })
+ ).toBeInTheDocument();
+ });
+
+ it('renders the correct number of items', () => {
+ render(<SocialMedia media={media} title={title} level={titleLevel} />);
+ expect(screen.getAllByRole('listitem')).toHaveLength(media.length);
+ });
+});