aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/organisms/widgets/sharing.test.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-04-15 17:13:21 +0200
committerArmand Philippot <git@armandphilippot.com>2022-04-15 17:40:40 +0200
commita07729064790df13324dbe7f4d1629892070558b (patch)
tree25a4bc6cc4386f35270e0fd3b633e909e6bcf853 /src/components/organisms/widgets/sharing.test.tsx
parentd9bf6f0d69ecb4475c06c772ef6314e5a7ee0fe8 (diff)
chore: add a SharingWidget component
Diffstat (limited to 'src/components/organisms/widgets/sharing.test.tsx')
-rw-r--r--src/components/organisms/widgets/sharing.test.tsx31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/components/organisms/widgets/sharing.test.tsx b/src/components/organisms/widgets/sharing.test.tsx
new file mode 100644
index 0000000..265dbe1
--- /dev/null
+++ b/src/components/organisms/widgets/sharing.test.tsx
@@ -0,0 +1,31 @@
+import { render, screen } from '@test-utils';
+import Sharing, { type SharingData } from './sharing';
+
+const postData: SharingData = {
+ excerpt: 'A post excerpt',
+ title: 'A post title',
+ url: 'https://sharing-website.test',
+};
+
+describe('Sharing', () => {
+ it('renders a sharing widget', () => {
+ render(
+ <Sharing
+ data={postData}
+ media={['facebook', 'twitter']}
+ expanded={true}
+ title="Sharing"
+ level={2}
+ />
+ );
+ expect(
+ screen.getByRole('link', { name: 'Share on facebook' })
+ ).toBeInTheDocument();
+ expect(
+ screen.getByRole('link', { name: 'Share on twitter' })
+ ).toBeInTheDocument();
+ expect(
+ screen.queryByRole('link', { name: 'Share on linkedin' })
+ ).not.toBeInTheDocument();
+ });
+});