import React from 'react'; import { afterEach, vi } from 'vitest'; import { cleanup } from '@testing-library/react'; import '@testing-library/jest-dom/vitest'; afterEach(() => { cleanup(); localStorage.clear(); }); vi.stubGlobal('alert', vi.fn()); vi.stubGlobal('confirm', vi.fn(() => true)); URL.createObjectURL = vi.fn(() => 'blob:mock-url'); URL.revokeObjectURL = vi.fn(); HTMLAnchorElement.prototype.click = vi.fn(); function makeStageEvent(x = 120, y = 80) { const stage = { getPointerPosition: () => ({ x, y }), getRelativePointerPosition: () => ({ x, y }), scaleX: () => 1, x: () => 0, y: () => 0, }; return { evt: { preventDefault: vi.fn(), deltaY: -1 }, target: { getStage: () => stage, }, }; } vi.mock('react-konva', () => ({ Stage: ({ children, onClick, onMouseDown, onMouseUp, onMouseMove, onWheel }: any) => (