UNPKG

wiremock-captain

Version:

A better way to use the WireMock simulator to test your HTTP APIs

65 lines (64 loc) 1.72 kB
import { WireMockFault } from './externalTypes'; export interface IMockedRequestResponse { id: string; newScenarioState?: string; priority?: number; request: IRequestMock; requiredScenarioState?: string; response: IResponseMock; scenarioName?: string; uuid: number; } export interface IMockType { request: IRequestMock; response: IResponseMock; priority?: number; scenarioName?: string; requiredScenarioState?: string; newScenarioState?: string; postServeActions?: [IWebhook]; metadata?: Record<string, unknown>; } export interface IMappingGetResponse { mappings: unknown[]; } export interface IRequestGetResponse { requests: unknown[]; } export interface IRequestMock { method: Method; [key: string]: unknown; } export type IResponseMock = { status: number; headers?: Record<string, KeyValue>; fixedDelayMilliseconds?: number; delayDistribution?: Record<string, number | string>; chunkedDribbleDelay?: Record<string, number>; transformers?: string[]; [key: string]: unknown; } | { fault: WireMockFault; }; export interface IScenarioGetResponse { scenarios: unknown[]; } export interface IWebhook { name: 'webhook'; parameters: { method: Method; url: string; headers?: Record<string, KeyValue>; body?: string; delay?: Record<string, number | string>; }; } export type KeyValue = boolean | number | string; export type Method = 'ANY' | 'CONNECT' | 'DELETE' | 'GET' | 'HEAD' | 'OPTIONS' | 'PATCH' | 'POST' | 'PUT' | 'TRACE'; export type WebhookBody = { type: 'JSON'; data: Record<string, unknown>; } | { type: 'String'; data: string; };