From 740e8c19b69289d205e7835d684b85813e2dec00 Mon Sep 17 00:00:00 2001 From: picklesrus Date: Thu, 17 Jun 2021 16:27:50 -0400 Subject: [PATCH] Add tests for single comment mode. --- test/unit/components/studio-comments.test.jsx | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/test/unit/components/studio-comments.test.jsx b/test/unit/components/studio-comments.test.jsx index 971e53304..43bcc0c55 100644 --- a/test/unit/components/studio-comments.test.jsx +++ b/test/unit/components/studio-comments.test.jsx @@ -97,6 +97,44 @@ describe('Studio comments', () => { expect(component.find('TopLevelComment').exists()).toBe(true); }); + test('Single comment load more shows when shouldShowCommentsList is true', () => { + // Make the component think this is a single view. + global.window.location.hash = '#comments-6'; + const component = mountWithIntl( + + ); + expect(component.find('div.studio-compose-container').exists()).toBe(true); + expect(component.find('TopLevelComment').exists()).toBe(true); + expect(component.find('Button').exists()).toBe(true); + expect(component.find('button.load-more-button').exists()).toBe(true); + global.window.location.hash = ''; + }); + + test('Single comment does not show when shouldShowCommentsList is false', () => { + // Make the component think this is a single view. + global.window.location.hash = '#comments-6'; + const component = mountWithIntl( + + ); + expect(component.find('div.studio-compose-container').exists()).toBe(true); + expect(component.find('TopLevelComment').exists()).toBe(false); + expect(component.find('Button').exists()).toBe(false); + expect(component.find('button.load-more-button').exists()).toBe(false); + global.window.location.hash = ''; + }); + test('Comment status error shows when shoudlShowCommentsGloballyOffError is true', () => { const component = mountWithIntl(