UNPKG

react-konva-grid

Version:

Declarative React Canvas Grid primitive for Data table, Pivot table, Excel Worksheets

26 lines (22 loc) 735 B
import { renderHook, act } from "@testing-library/react-hooks"; import useSelection from "./../hooks/useSelection"; describe("useSelection", () => { it("is a function", () => { expect(typeof useSelection).toBe("function"); }); it("sets initialselection to be empty", () => { const { result } = renderHook(() => useSelection()); expect(result.current.selections).toStrictEqual([]); }); it("picks up initialselection", () => { const initialSelections = [ { bounds: { top: 0, left: 0, right: 0, bottom: 0 } }, ]; const { result } = renderHook(() => useSelection({ initialSelections, }) ); expect(result.current.selections).toStrictEqual(initialSelections); }); });