UNPKG

@brizy/ui

Version:
24 lines (23 loc) 1.18 kB
import * as React from "react"; import { mount } from "enzyme"; import { MultipleUploadItem } from "../components/MultipleUploadItem"; import { BRZ_PREFIX } from "../../constants"; describe("Test MultipleUploadItem", function () { test("should have errorMessage", () => { const componentWithError = mount(React.createElement(MultipleUploadItem, { errorMessage: "Some error" })); expect(componentWithError).toMatchSnapshot(); expect(componentWithError.exists(`.${BRZ_PREFIX}-multiupload__error`)).toEqual(true); }); test("should have onClick", () => { const component = mount(React.createElement(MultipleUploadItem, { onClick: jest.fn() })); expect(component).toMatchSnapshot(); component.simulate("click", jest.fn()); expect.assertions(1); }); test("when click on settings, onClickSettings should be triggered", () => { const component = mount(React.createElement(MultipleUploadItem, { onClickSettings: jest.fn() })); expect(component).toMatchSnapshot(); component.find(`.${BRZ_PREFIX}-multiupload__settings`).simulate("click", jest.fn()); expect.assertions(1); }); });