import React from "react"; import { mount, shallow } from "enzyme"; import Checkbox from "."; const baseProps = { value: "test", }; describe("", () => { it("renders without error", () => { const wrapper = mount(); 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"); }); it("accepts isDisabled", () => { const wrapper = mount(); expect(wrapper.prop("isDisabled")).toEqual(true); }); it("accepts isIndeterminate", () => { const wrapper = mount(); expect(wrapper.prop("isIndeterminate")).toEqual(true); }); it("accepts isChecked", () => { const wrapper = mount(); expect(wrapper.prop("isChecked")).toEqual(true); }); it("accepts isChecked and isDisabled", () => { const wrapper = mount(); expect(wrapper.prop("isChecked")).toEqual(true); expect(wrapper.prop("isDisabled")).toEqual(true); }); it("componentDidUpdate() props lifecycle test", () => { const wrapper = shallow(); const instance = wrapper.instance(); instance.componentDidUpdate( { isChecked: true, }, wrapper.state() ); expect(wrapper.props()).toBe(wrapper.props()); instance.componentDidUpdate( { isChecked: false, }, wrapper.state() ); expect(wrapper.props()).toBe(wrapper.props()); }); });