More tests

This commit is contained in:
Chi Vinh Le
2018-09-24 20:13:54 +02:00
parent 62a1fc5901
commit 6e743b9b75
4 changed files with 64 additions and 0 deletions
@@ -20,6 +20,8 @@ it("renders correctly", () => {
disableShowAll: false,
indentLevel: 1,
me: null,
localReply: false,
disableReplies: false,
};
const wrapper = shallow(<ReplyListN {...props} />);
expect(wrapper).toMatchSnapshot();
@@ -19,8 +19,10 @@ exports[`renders correctly 1`] = `
"id": "comment-1",
}
}
disableReplies={false}
indentLevel={1}
key="comment-1"
localReply={false}
me={null}
/>
</withPropsOnChange(HorizontalGutter)>
@@ -38,8 +40,10 @@ exports[`renders correctly 1`] = `
"id": "comment-2",
}
}
disableReplies={false}
indentLevel={1}
key="comment-2"
localReply={false}
me={null}
/>
</withPropsOnChange(HorizontalGutter)>
@@ -32,6 +32,8 @@ it("renders username and body", () => {
},
indentLevel: 1,
showAuthPopup: noop as any,
localReply: false,
disableReplies: false,
};
const wrapper = shallow(<CommentContainerN {...props} />);
@@ -65,3 +67,33 @@ it("renders body only", () => {
const wrapper = shallow(<CommentContainerN {...props} />);
expect(wrapper).toMatchSnapshot();
});
it("hide reply button", () => {
const props: PropTypesOf<typeof CommentContainerN> = {
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(<CommentContainerN {...props} />);
expect(wrapper).toMatchSnapshot();
});
@@ -1,5 +1,31 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`hide reply button 1`] = `
<React.Fragment>
<IndentedComment
author={
Object {
"id": "author-id",
"username": "Marvin",
}
}
blur={false}
body="Woof"
createdAt="1995-12-17T03:24:00.000Z"
footer={
<React.Fragment>
<withContext(withLocalStateContainer(PermalinkContainer))
commentID="comment-id"
/>
</React.Fragment>
}
id="comment-comment-id"
indentLevel={1}
showEditedMarker={false}
/>
</React.Fragment>
`;
exports[`renders body only 1`] = `
<React.Fragment>
<IndentedComment