import { ClientConfig } from "@sanity/client"; import { SanityClient } from "@sanity/client"; import { vi } from "vitest"; /** * Creates a real Sanity client instance for testing that makes actual HTTP requests. * Use with mockApi() to intercept and mock the HTTP calls. * * @public * * @example * ```typescript * // Mock getGlobalCliClient to return a test client * vi.mock('@sanity/cli-core', async (importOriginal) => { * const actual = await importOriginal() * const {createTestClient} = await import('@sanity/cli-test') * * return { * ...actual, * getGlobalCliClient: vi.fn().mockImplementation((opts) => { * return Promise.resolve(createTestClient({ * apiVersion: opts.apiVersion, * })) * }), * } * }) * * // Then use mockApi to intercept requests * mockApi({ * apiVersion: 'v2025-02-19', * method: 'get', * uri: '/media-libraries', * }).reply(200, {data: [...]}) * ``` */ export declare function createTestClient(options: CreateTestClientOptions): { client: SanityClient; request: ReturnType; }; /** * Options for createTestClient * * @public */ export declare interface CreateTestClientOptions extends ClientConfig { /** * API version for the client */ apiVersion: string; /** * Authentication token */ token?: string; } export {};