diff --git a/app/components/post_attachment_opengraph/__snapshots__/post_attachment_opengraph.test.js.snap b/app/components/post_attachment_opengraph/__snapshots__/post_attachment_opengraph.test.js.snap index 73cdfd228..511342b6e 100644 --- a/app/components/post_attachment_opengraph/__snapshots__/post_attachment_opengraph.test.js.snap +++ b/app/components/post_attachment_opengraph/__snapshots__/post_attachment_opengraph.test.js.snap @@ -76,6 +76,59 @@ exports[`PostAttachmentOpenGraph should match snapshot, without image and descri `; +exports[`PostAttachmentOpenGraph should match snapshot, without site_name 1`] = ` + + + + + Title + + + + +`; + exports[`PostAttachmentOpenGraph should match state and snapshot, on renderDescription 1`] = `null`; exports[`PostAttachmentOpenGraph should match state and snapshot, on renderDescription 2`] = ` diff --git a/app/components/post_attachment_opengraph/post_attachment_opengraph.js b/app/components/post_attachment_opengraph/post_attachment_opengraph.js index eb0411666..e232b879d 100644 --- a/app/components/post_attachment_opengraph/post_attachment_opengraph.js +++ b/app/components/post_attachment_opengraph/post_attachment_opengraph.js @@ -234,8 +234,9 @@ export default class PostAttachmentOpenGraph extends PureComponent { const style = getStyleSheet(theme); - return ( - + let siteTitle; + if (openGraphData.site_name) { + siteTitle = ( + ); + } + + return ( + + {siteTitle} { expect(wrapper.find(TouchableOpacity).exists()).toEqual(true); }); + test('should match snapshot, without site_name', () => { + const newOpenGraphData = { + title: 'Title', + url: 'https://mattermost.com/', + }; + const wrapper = shallow( + + ); + expect(wrapper.getElement()).toMatchSnapshot(); + }); + test('should match state and snapshot, on renderImage', () => { const wrapper = shallow(