import * as React from 'react'; import HomeButton from './HomeButton'; import {render} from '@testing-library/react'; import {testA11y} from '../../axe'; describe('HomeButton', () => { it('render', () => { const button = render(); expect(button.getAllByRole('img').length).toBeGreaterThan(0); expect(button.getByRole('link')).toBeTruthy(); }); it('href', () => { const button = render(); expect(button.getByRole('link').getAttribute('href')).toEqual( 'http://foo.com' ); }); it('empty href', () => { const button = render(Test); expect(button.getByRole('link').getAttribute('href')).toEqual('#'); }); it('should have a label', () => { const logo = render(); expect(logo.getByLabelText('brainly home')).toBeTruthy(); }); describe('a11y', () => { it('should have no a11y violations', async () => { await testA11y(); }); }); });