import React from "react"; import { mount } from "enzyme"; import Badge from "."; describe("", () => { it("renders without error", () => { const wrapper = mount(); expect(wrapper).toExist(); }); it("displays label", () => { const wrapper = mount(); expect(wrapper.prop("label")).toBe("10"); }); it("call onClick()", () => { const onClick = jest.fn(); const wrapper = mount(); wrapper.simulate("click"); expect(onClick).toBeCalled(); }); it("call onClick() without wrapper", () => { const wrapper = mount(); wrapper.simulate("click"); expect(wrapper).toExist(); }); 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("color", "red"); }); });