UNPKG

xelpmoc-core

Version:

Xelpmoc Core UI

35 lines (29 loc) 745 B
import Button from "./Button.js"; import { mount } from "enzyme"; describe("Button", () => { let props; let button; const Button = () => { if (!button) { button = mount(<Button {...props} />); } return button; }; beforeEach(() => { const icon = { element: <div className="element" />, hoveredElement: <div className="hoveredElement" /> }; }); it("always renders a div", () => { const divs = button().find("div"); expect(divs.length).toBeGreaterThan(0); }); }); /* What do I need to test? 1. a div is rendered 2. If an icon is passed in, and the icon has an element a div is rendered with that icon 3. If the icon has a hovered element, the hovered element shows on hover? 4. */