import * as React from "react"; import { mount, shallow } from "enzyme"; import sinon from "sinon"; import Tag from "../Tag"; describe("Component: Tag", () => { test("snapshot", () => { const tag = shallow(); expect(tag).toMatchSnapshot(); const tag2 = shallow( {}} /> ); expect(tag2).toMatchSnapshot(); }); test("onClose is triggered correctly", () => { const spy = sinon.spy(); const tag = mount(); tag.find("i").simulate("click"); expect(spy.calledOnce).toBeTruthy(); }); });