From e5ac95d05056fa13def1f8d80c00fc6e170f362e Mon Sep 17 00:00:00 2001 From: Justin Date: Tue, 5 Apr 2022 09:43:26 -0400 Subject: [PATCH] Add tests for Avatar --- app/soapbox/components/still_image.js | 2 +- .../ui/avatar/__tests__/avatar.test.tsx | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 app/soapbox/components/ui/avatar/__tests__/avatar.test.tsx diff --git a/app/soapbox/components/still_image.js b/app/soapbox/components/still_image.js index 1773fc0c3..323960a37 100644 --- a/app/soapbox/components/still_image.js +++ b/app/soapbox/components/still_image.js @@ -54,7 +54,7 @@ class StillImage extends React.PureComponent { const hoverToPlay = this.hoverToPlay(); return ( -
+
{alt} {hoverToPlay && }
diff --git a/app/soapbox/components/ui/avatar/__tests__/avatar.test.tsx b/app/soapbox/components/ui/avatar/__tests__/avatar.test.tsx new file mode 100644 index 000000000..b46e5e029 --- /dev/null +++ b/app/soapbox/components/ui/avatar/__tests__/avatar.test.tsx @@ -0,0 +1,20 @@ +import React from 'react'; + +import { render, screen } from '../../../../jest/test-helpers'; +import Avatar from '../avatar'; + +const src = '/static/alice.jpg'; + +describe('', () => { + it('renders', () => { + render(); + + expect(screen.getByRole('img')).toBeInTheDocument(); + }); + + it('handles size props', () => { + render(); + + expect(screen.getByTestId('still-image-container').getAttribute('style')).toMatch(/50px/i); + }); +});