app/frontend/comments/comment.component.test.tsx in decidim-comments-0.2.0 vs app/frontend/comments/comment.component.test.tsx in decidim-comments-0.3.0
- old
+ new
@@ -43,10 +43,21 @@
it("should render author's name in a link with class author__name", () => {
const wrapper = shallow(<Comment comment={comment} session={session} />);
expect(wrapper.find("a.author__name").text()).toEqual(comment.author.name);
});
+ describe("when the author's account has been deleted", () => {
+ beforeEach(() => {
+ comment.author.deleted = true;
+ });
+
+ it("should render 'Deleted user' inside a badge", () => {
+ const wrapper = shallow(<Comment comment={comment} session={session} />);
+ expect(wrapper.find("span.label.label--small.label--basic").text()).toEqual("Deleted user");
+ });
+ });
+
it("should render author's avatar as a image tag", () => {
const wrapper = shallow(<Comment comment={comment} session={session} />);
expect(wrapper.find("a.author__avatar img").prop("src")).toEqual(comment.author.avatarUrl);
});
@@ -143,10 +154,10 @@
});
it("should render a 'in favor' badge if comment's alignment is 1", () => {
comment.alignment = 1;
const wrapper = shallow(<Comment comment={comment} session={session} />);
- expect(wrapper.find("span.success.label").text()).toEqual("In favor");
+ expect(wrapper.find("span.alignment.label").text()).toEqual("In favor");
});
it("should render a 'against' badge if comment's alignment is -1", () => {
comment.alignment = -1;
const wrapper = shallow(<Comment comment={comment} session={session} />);