import React from 'react' import { render, screen } from '@testing-library/react' import { MeetingPointIcon } from '../icon/meetingPoint' import { Address } from './Address' import { Distances, Proximity, ProximityDisplay } from './Proximity' const CustomLinkElement = ({ href }: Readonly<{ href: string }>): JSX.Element => describe('Address', () => { it('Should render the list item', () => { render(
) expect(screen.getByRole('listitem')).toBeInTheDocument() expect(screen.getByText('Paris')).toBeInTheDocument() expect(screen.getByText('09:00')).toBeInTheDocument() }) it('Should render sublabel', () => { render(
) expect(screen.getByRole('listitem')).toBeInTheDocument() expect(screen.getByText('6 rue ménars')).toBeInTheDocument() expect(screen.getByText('Paris')).toBeInTheDocument() expect(screen.getByText('09:00')).toBeInTheDocument() }) it('Should use a11y attributes', () => { render(
) expect( screen.getByRole('listitem', { name: 'Departure at 09:00 from Paris' }), ).toBeInTheDocument() }) it('Should render a link', () => { render(
) expect(screen.getByRole('link')).toBeInTheDocument() expect(screen.getByRole('link')).toHaveAttribute('href', 'https://blablacar.fr') }) it('Should render a custom element as link', () => { render(
} />, ) expect(screen.getByRole('link')).toBeInTheDocument() expect(screen.getByRole('link')).toHaveAttribute('href', 'https://blablacar.ru') }) it('Should render proximity pills', () => { const proximity = render(
) expect(screen.getByText("You'll have to take transports")).toBeInTheDocument() }) it('Should render proximity label', () => { const proximity = ( ) render(
) expect(screen.getByText("You'll get there by foot")).toBeInTheDocument() }) it('Should render a custom icon', () => { render(
} />) expect(screen.getByText('Here')).toBeInTheDocument() }) })