aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/organisms/widgets/sharing.test.tsx
blob: c7211f0aed5ed2cc91e058e1ae35e318793e8eba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { describe, expect, it } from '@jest/globals';
import { render, screen as rtlScreen } from '../../../../tests/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']} />);
    expect(
      rtlScreen.getByRole('link', { name: 'Share on Facebook' })
    ).toBeInTheDocument();
    expect(
      rtlScreen.getByRole('link', { name: 'Share on Twitter' })
    ).toBeInTheDocument();
    expect(
      rtlScreen.queryByRole('link', { name: 'Share on LinkedIn' })
    ).not.toBeInTheDocument();
  });
});