wiremock-captain
Version:
A better way to use the WireMock simulator to test your HTTP APIs
30 lines (29 loc) • 1.67 kB
TypeScript
import { IWireMockFeatures, IWireMockRequest, IWireMockResponse } from '.';
import { IMockedRequestResponse, Method } from './types/internalTypes';
import { WireMock } from './WireMock';
export declare class WireMockAPI extends WireMock {
protected readonly endpoint: string;
protected readonly method: Method;
readonly features: IWireMockFeatures;
constructor(baseUrl: string, endpoint: string, method: Method, features?: Omit<IWireMockFeatures, 'scenario' | 'stubPriority'>);
/**
* Creates a new stub with desired request and response match
* @param request Request object for the stub mapping
* @param response Response object for the stub mapping
* @param features Additional options to be used for creation of stub mapping
* @returns Created wiremock stub mapping. Contains `id` which is needed to delete a mapping
*/
register(request: Omit<IWireMockRequest, 'endpoint' | 'method'>, response: IWireMockResponse, features?: IWireMockFeatures): Promise<IMockedRequestResponse>;
/**
* Creates a new default stub with desired response
* @param response Response object for the stub mapping
* @param features Additional options to be used for creation of stub mapping
* @returns Created wiremock stub mapping. Contains `id` which is needed to delete a mapping
*/
registerDefaultResponse(response: IWireMockResponse, features?: IWireMockFeatures): Promise<IMockedRequestResponse>;
/**
* Returns list of request(s) made to the WireMock API
* @returns List of wiremock requests made to the endpoint with given method
*/
getRequestsForAPI(): Promise<unknown[]>;
}