aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/molecules/buttons/back-to-top/back-to-top.test.tsx
blob: 00eb0205d7d5acf9486df4adf6ae04a23680bac8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { describe, expect, it } from '@jest/globals';
import { render, screen as rtlScreen } from '@testing-library/react';
import { BackToTop } from './back-to-top';

describe('BackToTop', () => {
  it('renders a BackToTop link', () => {
    const anchor = '#top';
    const label = 'eveniet';

    render(<BackToTop anchor={anchor} label={label} />);

    const link = rtlScreen.getByRole('link');

    expect(link).toHaveAccessibleName(label);
    expect(link).toHaveAttribute('href', anchor);
  });
});