Files
Pien-Studio/apps/web/hooks/use-editor-bindings.test.tsx
T
2026-05-10 03:06:54 +07:00

18 lines
716 B
TypeScript

import { renderHook } from "@testing-library/react";
import { describe, expect, it } from "vitest";
import { useEditorStore } from "../store/editor-store";
import { useEditorBindings } from "./use-editor-bindings";
describe("useEditorBindings", () => {
it("returns selected layer derived from store state", () => {
useEditorStore.getState().resetProject();
useEditorStore.getState().addLayerByType("text");
const { result } = renderHook(() => useEditorBindings());
expect(result.current.state.project.layers.length).toBe(1);
expect(result.current.state.selectedLayer?.id).toBe(result.current.state.selectedLayerId);
expect(typeof result.current.actions.undo).toBe("function");
});
});