import React from "react"; import { mount } from "enzyme"; import Avatar from "."; const baseProps = { size: "max", role: "user", source: "", editLabel: "Edit", userName: "Demo User", editing: false, editAction: () => jest.fn(), }; describe("", () => { it("renders without error", () => { const wrapper = mount(); expect(wrapper).toExist(); }); it("render owner avatar", () => { const wrapper = mount(); expect(wrapper.prop("role")).toEqual("owner"); }); it("render guest avatar", () => { const wrapper = mount(); expect(wrapper.prop("role")).toEqual("guest"); }); it("render big avatar", () => { const wrapper = mount(); expect(wrapper.prop("size")).toEqual("big"); }); it("render medium avatar", () => { const wrapper = mount(); expect(wrapper.prop("size")).toEqual("medium"); }); it("render small avatar", () => { const wrapper = mount(); expect(wrapper.prop("size")).toEqual("small"); }); it("render min avatar", () => { const wrapper = mount(); expect(wrapper.prop("size")).toEqual("min"); }); it("render empty avatar", () => { const wrapper = mount(); expect(wrapper.prop("userName")).toEqual(""); expect(wrapper.prop("source")).toEqual(""); }); it("render source avatar", () => { const wrapper = mount( ); expect(wrapper.prop("userName")).toEqual("Demo User"); expect(wrapper.prop("source")).toEqual("demo"); }); it("render initials avatar", () => { const wrapper = mount( ); expect(wrapper.prop("userName")).toEqual("Demo User"); expect(wrapper.prop("source")).toEqual(""); }); it("render editing avatar", () => { const wrapper = mount(); expect(wrapper.prop("editing")).toEqual(true); }); it("accepts id", () => { const wrapper = mount(); expect(wrapper.prop("id")).toEqual("testId"); }); it("accepts className", () => { const wrapper = mount(); expect(wrapper.prop("className")).toEqual("test"); }); it("accepts style", () => { const wrapper = mount(); expect(wrapper.getDOMNode().style).toHaveProperty("width", "100px"); }); });