import type { AxiosRequestConfig } from "axios"; import { type ItemResult, type ListResult } from "./api-client.js"; import type { ItemMethod, ListMethod, Method, TypeDiscriminatorToType } from "./metadata.js"; type PromiseOrSync = T | Promise; type EndpointSpec = Method | `/${string}/${"list" | "get" | "count" | "save" | "bulkSave" | "delete" | string}`; type EndpointMock = (request: AxiosRequestConfig) => PromiseOrSync : TEndpoint extends ItemMethod ? ItemResult> : ItemResult | ListResult>; /** Mock a coalesce API endpoint, providing your own implementation for the API request. * Example: * ``` * mockEndpoint( "/Course/list", (req) => ({ wasSuccessful: true, list: [ { courseId: 1, title: "CS 101" }, { courseId: 2, title: "CS 102" }, ], }) ) * ``` * * Example: * ``` * const fn = mockEndpoint( new Student().$metadata.methods.getName, vitest.fn((req) => ({ wasSuccessful: true, object: "Steve", })) ) // Do testing ... expect(fn).toHaveBeenCalledOnce(); fn.destroy(); * ``` */ export declare function mockEndpoint>(endpoint: TEndpoint, mock: TMock): TMock & { /** Tear down the mock, removing the handler from the global axios adapter. */ destroy(): void; }; export {};