import { FileDownloadAsBase64Response, FileDownloadResponse, FileDownloadStreamResponse, FileMetadata, FileUploadBytes, FileUploadOptions, FileUploadResponse, FileUploadStreamOptions } from "../../runtime/file.mjs"; import { Mock } from "vitest"; //#region src/vitest/mocks/file.d.ts type FileResolver = (method: string, call: FileCall) => unknown; interface FileCall { method: string; namespace: string; tableName: string; fieldName: string; recordId: string; } /** Controls fallback behavior for File calls without a configured result. */ export interface MockFileOptions { /** Return a type-compatible fixture or throw when no behavior is configured. */ onUnhandled?: "fallback" | "error"; } /** * Acquire a disposable mock for `tailordb.file`. Restored on dispose. * @param options - Controls behavior for calls without a configured result * @returns Disposable File mock control object * @example * ```typescript * import { mockFile } from "@tailor-platform/sdk/vitest"; * * test("mock file download", async () => { * using file = mockFile(); * file.download.mockResolvedValue({ data: new Uint8Array(), metadata: { ... } }); * // … * }); * ``` */ export declare function mockFile(options?: MockFileOptions): { setResolver(value: FileResolver): void; /** * Enqueue a single result for the next `tailordb.file` call. * The queue is shared across all methods and namespaces. * @param result - Result to return from the next file call */ enqueueResult(result: unknown): void; /** * Enqueue results for multiple subsequent `tailordb.file` calls. * The queue is shared across all methods and namespaces. * @param results - Results to enqueue, one per upcoming call */ enqueueResults(...results: unknown[]): void; calls: FileCall[]; clear(): void; reset(): void; delete: Mock<(namespace: string, tableName: string, fieldName: string, recordId: string) => Promise>; download: Mock<(namespace: string, tableName: string, fieldName: string, recordId: string) => Promise>; downloadAsBase64: Mock<(namespace: string, tableName: string, fieldName: string, recordId: string) => Promise>; getMetadata: Mock<(namespace: string, tableName: string, fieldName: string, recordId: string) => Promise>; downloadStream: Mock<(namespace: string, tableName: string, fieldName: string, recordId: string) => Promise>; uploadStream: Mock<(namespace: string, tableName: string, fieldName: string, recordId: string, readableStream: ReadableStream, options?: FileUploadStreamOptions) => Promise>; upload: Mock<(namespace: string, tableName: string, fieldName: string, recordId: string, data: string | FileUploadBytes, options?: Omit) => Promise>; } & Disposable; //#endregion