import { cleanup } from '@testing-library/react'; import { render } from '../../utils/theme-render-wrapper'; import { Avatar } from './avatar'; afterEach(cleanup); describe('', () => { it(`Should render with initials(tag p)`, () => { const initials = 'SK'; const { queryByText } = render(); const initialsEl = queryByText(initials); expect(initialsEl?.innerHTML).toBe(initials); }); it(`Should render as "not verified"`, () => { const { container } = render(); const iconEl = container.getElementsByTagName('svg'); expect(iconEl).toBeTruthy(); }); it(`Should render avatar with src`, () => { const src = 'https://cdn.iconscout.com/icon/free/png-256/avatar-366-456318.png'; const { container } = render(); const imgEl = container.querySelector('img'); expect(imgEl?.src).toBe(src); expect(imgEl).not.toBeNull(); }); it(`Should render avatar with icon`, () => { const src = 'https://cdn.iconscout.com/icon/free/png-256/avatar-366-456318.png'; const { container } = render(); const iconEl = container.getElementsByTagName('svg'); expect(iconEl).toBeTruthy(); }); it(`Should render custom size avatar`, () => { const { baseElement } = render(); expect(baseElement).toBeTruthy(); }); });