aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/organisms/widgets/sharing.test.tsx
blob: 265dbe1bf740ce65b00cb7becdc70057404fb95a (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
25
26
27
28
29
30
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();
  });
});