import React from "react";
import { mount, shallow } from "enzyme";
import HelpButton from ".";
const tooltipContent = "You tooltip content";
describe("", () => {
it("HelpButton renders without error", () => {
const wrapper = mount();
expect(wrapper).toExist();
});
it("HelpButton componentWillUnmount test", () => {
const wrapper = mount();
const componentWillUnmount = jest.spyOn(
wrapper.instance(),
"componentWillUnmount"
);
wrapper.unmount();
expect(componentWillUnmount).toHaveBeenCalled();
});
it("HelpButton test afterHide function", () => {
const wrapper = shallow(
).instance();
wrapper.afterHide();
expect(wrapper.state.hideTooltip).toEqual(false);
wrapper.setState({ hideTooltip: false });
wrapper.afterHide();
expect(wrapper.state.hideTooltip).toEqual(false);
});
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");
});
});