import { C as CimplifyClient } from './catalogue-B4eLL8Mi.js'; import { A as AppHandle, C as CreateAppOptions } from './server-Dckg4Vdr.js'; /** * Test client + fixtures. * * Spins up an in-process Hono mock and a typed SDK client wired to it * via the SDK's first-class `fetch` injection — no global mutation, * no port, no MSW. Tests in the same module run in parallel safely. * * import { createTestClient, fixtures } from "@cimplify/sdk/testing"; * * const handle = createTestClient({ seed: "fashion" }); * try { * const item = await fixtures.addFirstProduct(handle.client); * expect(item.product.name).toBeTruthy(); * } finally { * handle.dispose(); * } */ interface TestClientHandle { /** Typed SDK client routed to the in-process mock. */ client: CimplifyClient; /** Direct access to the mock — registry, deps, request shortcut. */ mock: AppHandle; /** Reset all in-memory state (cart, orders, sessions). Token persists. */ reset: () => void; /** Drop all state + session. Always safe to call multiple times. */ dispose: () => void; } /** * Create an in-process mock + a typed SDK client wired to it. * * Each call gets its OWN session token — tests in the same module * run safely in parallel because there's no shared global state. */ declare function createTestClient(options?: CreateAppOptions): TestClientHandle; interface ProductSummary { id: string; name: string; slug: string; type?: string; } interface AddFirstProductOptions { /** Pick a specific product by slug instead of "first". */ slug?: string; /** Auto-pick the first available variant if the product has variants. Default true. */ withVariant?: boolean; } interface AddFirstProductResult { product: ProductSummary; variantId?: string; } /** * Pre-baked fixture functions for common test setup. Use these to keep * tests focused on the assertion you care about, not on plumbing. */ declare const fixtures: { /** * Add the first available product (or a named one) to the cart. * Picks the first variant if the product has variants. */ addFirstProduct(client: CimplifyClient, opts?: AddFirstProductOptions): Promise; /** A minimal valid customer object for checkout. */ customer(overrides?: Partial<{ name: string; email: string; phone: string; }>): { name: string; email: string; phone: string; save_details: boolean; }; deliveryAddress(overrides?: Partial<{ street_address: string; city: string; region: string; }>): { street_address: string; city: string; region: string; }; /** * Run the full guest auth flow (request OTP → verify) and return * the new session token. The mock's permissive auth mode echoes * the code in `request_otp`, so we don't need to read it. */ authenticate(client: CimplifyClient, contact?: string, code?: string): Promise<{ token: string; customerId: string; }>; }; export { type AddFirstProductOptions as A, type ProductSummary as P, type TestClientHandle as T, type AddFirstProductResult as a, createTestClient as c, fixtures as f };