From 6e743b9b75da2cd1449edab2bad14efa2cecc0c8 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Mon, 24 Sep 2018 20:13:54 +0200 Subject: [PATCH] More tests --- .../comments/components/ReplyList.spec.tsx | 2 ++ .../__snapshots__/ReplyList.spec.tsx.snap | 4 +++ .../containers/CommentContainer.spec.tsx | 32 +++++++++++++++++++ .../CommentContainer.spec.tsx.snap | 26 +++++++++++++++ 4 files changed, 64 insertions(+) diff --git a/src/core/client/stream/tabs/comments/components/ReplyList.spec.tsx b/src/core/client/stream/tabs/comments/components/ReplyList.spec.tsx index b978b0955..c8b3dcbb2 100644 --- a/src/core/client/stream/tabs/comments/components/ReplyList.spec.tsx +++ b/src/core/client/stream/tabs/comments/components/ReplyList.spec.tsx @@ -20,6 +20,8 @@ it("renders correctly", () => { disableShowAll: false, indentLevel: 1, me: null, + localReply: false, + disableReplies: false, }; const wrapper = shallow(); expect(wrapper).toMatchSnapshot(); diff --git a/src/core/client/stream/tabs/comments/components/__snapshots__/ReplyList.spec.tsx.snap b/src/core/client/stream/tabs/comments/components/__snapshots__/ReplyList.spec.tsx.snap index cd78852c3..0b4cbcd15 100644 --- a/src/core/client/stream/tabs/comments/components/__snapshots__/ReplyList.spec.tsx.snap +++ b/src/core/client/stream/tabs/comments/components/__snapshots__/ReplyList.spec.tsx.snap @@ -19,8 +19,10 @@ exports[`renders correctly 1`] = ` "id": "comment-1", } } + disableReplies={false} indentLevel={1} key="comment-1" + localReply={false} me={null} /> @@ -38,8 +40,10 @@ exports[`renders correctly 1`] = ` "id": "comment-2", } } + disableReplies={false} indentLevel={1} key="comment-2" + localReply={false} me={null} /> diff --git a/src/core/client/stream/tabs/comments/containers/CommentContainer.spec.tsx b/src/core/client/stream/tabs/comments/containers/CommentContainer.spec.tsx index 772a8df79..049062795 100644 --- a/src/core/client/stream/tabs/comments/containers/CommentContainer.spec.tsx +++ b/src/core/client/stream/tabs/comments/containers/CommentContainer.spec.tsx @@ -32,6 +32,8 @@ it("renders username and body", () => { }, indentLevel: 1, showAuthPopup: noop as any, + localReply: false, + disableReplies: false, }; const wrapper = shallow(); @@ -65,3 +67,33 @@ it("renders body only", () => { const wrapper = shallow(); expect(wrapper).toMatchSnapshot(); }); + +it("hide reply button", () => { + const props: PropTypesOf = { + me: null, + asset: { + id: "asset-id", + }, + comment: { + id: "comment-id", + author: { + id: "author-id", + username: "Marvin", + }, + body: "Woof", + createdAt: "1995-12-17T03:24:00.000Z", + editing: { + edited: false, + editableUntil: "1995-12-17T03:24:30.000Z", + }, + pending: false, + }, + indentLevel: 1, + showAuthPopup: noop as any, + localReply: false, + disableReplies: true, + }; + + const wrapper = shallow(); + expect(wrapper).toMatchSnapshot(); +}); diff --git a/src/core/client/stream/tabs/comments/containers/__snapshots__/CommentContainer.spec.tsx.snap b/src/core/client/stream/tabs/comments/containers/__snapshots__/CommentContainer.spec.tsx.snap index db1219282..1f37c5456 100644 --- a/src/core/client/stream/tabs/comments/containers/__snapshots__/CommentContainer.spec.tsx.snap +++ b/src/core/client/stream/tabs/comments/containers/__snapshots__/CommentContainer.spec.tsx.snap @@ -1,5 +1,31 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`hide reply button 1`] = ` + + + + + } + id="comment-comment-id" + indentLevel={1} + showEditedMarker={false} + /> + +`; + exports[`renders body only 1`] = `