import { FileValidationStatusType } from '@shipstatic/types'; import { d as DropReturn, P as ProcessedFile } from './useDrop-vakC-Kel.js'; import '@shipstatic/ship'; /** * Test utilities for consumers of `useDrop`. * * ```typescript * import { createMockDrop } from '@shipstatic/drop/testing'; * ``` * * The whole subpath exists for one reason: a `DropReturn` has twenty fields, and * a component test that takes `drop` as a prop should not have to build them. * Everything else — spying, matching, asserting — belongs to your test framework, * so this file deliberately ships none of it. */ /** * Build a `DropReturn` for rendering tests. * * Any field can be overridden, including with your own spies — which is how you * assert on interactions: * * ```tsx * const reset = vi.fn(); * const drop = createMockDrop({ phase: 'ready', files: [...], reset }); * * render(); * await userEvent.click(screen.getByText('Clear')); * * expect(reset).toHaveBeenCalled(); * ``` * * The convenience booleans (`isProcessing`, `hasError`, `isInteractive`) and * `validFiles` are derived from `phase` and `files` unless you override them, so * the mock can never present a state the real hook could not reach by accident. */ declare function createMockDrop(overrides?: Partial): DropReturn; /** * A `useDrop` replacement for consumers that call the hook rather than receiving * `drop` as a prop. * * ```tsx * vi.mock('@shipstatic/drop', () => ({ useDrop: mockUseDrop({ phase: 'ready' }) })); * ``` * * Framework-agnostic on purpose — it returns a function, and your test framework * installs it. The value is not the three lines it saves: it is that the mock's * shape comes from `createMockDrop`, so it cannot describe a hook this package * does not have. A hand-written module mock can, and did — one consumer described * react-dropzone's API (`rejectedFiles`, `isDragActive`, `getRootProps`, `clear`) * for months, because nothing typechecked it. * * Note this replaces the WHOLE module. If you also import `processFiles` or a * type from `@shipstatic/drop`, spread the real module in first: * * ```tsx * vi.mock('@shipstatic/drop', async (importOriginal) => ({ * ...(await importOriginal()), * useDrop: mockUseDrop({ phase: 'ready' }), * })); * ``` */ declare function mockUseDrop(overrides?: Partial): () => DropReturn; /** Build a `ProcessedFile` backed by a real `File`. */ declare function createMockProcessedFile(name: string, options?: { path?: string; content?: string; type?: string; status?: FileValidationStatusType; statusMessage?: string; }): ProcessedFile; /** * Build a real `File` carrying a folder-relative path, the way a browser * presents a folder drop. (`webkitRelativePath` is read-only, hence the * redefinition — the one part of this that is not a one-liner.) */ declare function createMockFileWithPath(name: string, webkitRelativePath: string, content?: string, type?: string): File; export { createMockDrop, createMockFileWithPath, createMockProcessedFile, mockUseDrop };