diff --git a/src/components/Avatar/Avatar.tsx b/src/components/Avatar/Avatar.tsx index 2d8ee86d6..973ed7f52 100644 --- a/src/components/Avatar/Avatar.tsx +++ b/src/components/Avatar/Avatar.tsx @@ -66,7 +66,7 @@ export const Avatar = ({ return initials; }, [nameString, size]); - const showImage = typeof imageUrl === 'string' && !error; + const showImage = typeof imageUrl === 'string' && imageUrl && !error; return (
{ expect(queryByTestId(AVATAR_IMG_TEST_ID)).not.toBeInTheDocument(); }); + it('should render fallback when imageUrl is an empty string', () => { + const { getByTestId, queryByTestId } = render( + , + ); + expect(queryByTestId(AVATAR_IMG_TEST_ID)).not.toBeInTheDocument(); + expect(getByTestId(AVATAR_FALLBACK_TEST_ID)).toHaveTextContent('fS'); + }); + it('should call onClick prop on user click', () => { const onClick = vi.fn();