aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/molecules/nav/nav-link/nav-link.test.tsx
blob: aa9b557325a1938eff08c69d9bb961586fdaf828 (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
import { describe, expect, it } from '@jest/globals';
import { render, screen as rtlScreen } from '@testing-library/react';
import { NavLink } from './nav-link';

describe('NavLink', () => {
  it('renders a link', () => {
    const label = 'eius';
    const target = '#harum';

    render(<NavLink href={target} label={label} />);

    expect(rtlScreen.getByRole('link', { name: label })).toHaveAttribute(
      'href',
      target
    );
  });

  it('can render a nav link with inlined contents', () => {
    const label = 'eius';
    const target = '#harum';

    render(<NavLink href={target} isInline label={label} />);

    expect(rtlScreen.getByRole('link', { name: label })).toHaveClass(
      'link--inline'
    );
  });
});