import * as React from 'react';
import { render } from '@testing-library/react';
import { Avatar } from '../avatar';
describe('Avatar', () => {
it('should render correctly', () => {
const wrapper = render();
expect(() => wrapper.unmount()).not.toThrow();
});
it('ref should be forwarded', () => {
const ref = React.createRef();
render();
expect(ref.current).not.toBeNull();
});
it('should populate imgRef', () => {
const imgRef = React.createRef();
const wrapper = render();
setTimeout(() => expect(imgRef.current).not.toBeNull(), 500);
expect(() => wrapper.unmount()).not.toThrow();
});
it('should render initials', () => {
const { container } = render(Junior);
expect(container.querySelector('span')).toHaveTextContent('Jun');
});
});