import React from 'react'; import { render, screen } from '@testing-library/react'; import { NavigationItem } from './'; describe('NavigationItem component', () => { describe('given default props', () => { it('has a `div` as child by default and displays the label inside of it', () => { render(); expect(screen.getByText('Accounting integration')).toBeVisible(); }); }); describe('given a `component` props', () => { it("doesn't display the `div` anymore", () => { render( , ); expect( screen.getByRole('link', { name: 'Accounting integration' }), ).toBeVisible(); expect( screen.getByRole('link', { name: 'Accounting integration' }), ).toHaveAttribute('href', '/accounting-integration'); }); }); describe('given addon props', () => { it('renders the leftAddons and rightAddons when provided', () => { render( Left addon

} rightAddon={

Right addon

} />, ); expect(screen.getByText('Left addon')).toBeVisible(); expect(screen.getByText('Right addon')).toBeVisible(); }); }); });