@pact-foundation/pact
Version:
Pact for all things Javascript
89 lines (88 loc) • 5.08 kB
TypeScript
import { ConsumerInteraction, ConsumerPact } from '@pact-foundation/pact-core';
import { JsonMap } from '../../common/jsonTypes';
import { Path, TemplateHeaders, TemplateQuery } from '../../v3';
import { PactV4Options, PluginConfig, V4InteractionWithCompleteRequest, V4InteractionWithPlugin, V4InteractionwithRequest, V4InteractionWithResponse, V4MockServer, V4Request, V4RequestBuilder, V4RequestBuilderFunc, V4ResponseBuilder, V4ResponseBuilderFunc, V4UnconfiguredInteraction, V4Response, V4InteractionWithPluginRequest, V4PluginResponseBuilderFunc, V4InteractionWithPluginResponse, V4RequestWithPluginBuilder, V4ResponseWithPluginBuilder, V4PluginRequestBuilderFunc, TestFunction } from './types';
export declare class UnconfiguredInteraction implements V4UnconfiguredInteraction {
protected pact: ConsumerPact;
protected interaction: ConsumerInteraction;
protected opts: PactV4Options;
protected cleanupFn: () => void;
constructor(pact: ConsumerPact, interaction: ConsumerInteraction, opts: PactV4Options, cleanupFn: () => void);
uponReceiving(description: string): V4UnconfiguredInteraction;
given(state: string, parameters?: JsonMap): V4UnconfiguredInteraction;
withCompleteRequest(request: V4Request): V4InteractionWithCompleteRequest;
withRequest(method: string, path: Path, builder?: V4RequestBuilderFunc): V4InteractionwithRequest;
usingPlugin(config: PluginConfig): V4InteractionWithPlugin;
}
export declare class InteractionWithCompleteRequest implements V4InteractionWithCompleteRequest {
private pact;
private interaction;
private opts;
protected cleanupFn: () => void;
constructor(pact: ConsumerPact, interaction: ConsumerInteraction, opts: PactV4Options, cleanupFn: () => void);
withCompleteResponse(response: V4Response): V4InteractionWithResponse;
}
export declare class InteractionwithRequest implements V4InteractionwithRequest {
private pact;
private interaction;
private opts;
protected cleanupFn: () => void;
constructor(pact: ConsumerPact, interaction: ConsumerInteraction, opts: PactV4Options, cleanupFn: () => void);
willRespondWith(status: number, builder?: V4ResponseBuilderFunc): InteractionWithResponse;
}
export declare class RequestBuilder implements V4RequestBuilder {
protected interaction: ConsumerInteraction;
constructor(interaction: ConsumerInteraction);
query(query: TemplateQuery): this;
headers(headers: TemplateHeaders): this;
jsonBody(body: unknown): this;
binaryFile(contentType: string, file: string): this;
multipartBody(contentType: string, file: string, mimePartName: string): this;
body(contentType: string, body: Buffer): this;
}
export declare class ResponseBuilder implements V4ResponseBuilder {
protected interaction: ConsumerInteraction;
constructor(interaction: ConsumerInteraction);
headers(headers: TemplateHeaders): this;
jsonBody(body: unknown): this;
binaryFile(contentType: string, file: string): this;
multipartBody(contentType: string, file: string, mimePartName: string): this;
body(contentType: string, body: Buffer): this;
}
export declare class InteractionWithResponse implements V4InteractionWithResponse {
private pact;
private opts;
protected cleanupFn: () => void;
constructor(pact: ConsumerPact, opts: PactV4Options, cleanupFn: () => void);
executeTest<T>(testFn: TestFunction<T>): Promise<T | undefined>;
}
export declare class InteractionWithPlugin implements V4InteractionWithPlugin {
private pact;
private interaction;
private opts;
protected cleanupFn: () => void;
constructor(pact: ConsumerPact, interaction: ConsumerInteraction, opts: PactV4Options, cleanupFn: () => void);
usingPlugin(config: PluginConfig): V4InteractionWithPlugin;
withRequest(method: string, path: Path, builder?: V4PluginRequestBuilderFunc): V4InteractionWithPluginRequest;
}
export declare class InteractionWithPluginRequest implements V4InteractionWithPluginRequest {
private pact;
private interaction;
private opts;
protected cleanupFn: () => void;
constructor(pact: ConsumerPact, interaction: ConsumerInteraction, opts: PactV4Options, cleanupFn: () => void);
willRespondWith(status: number, builder?: V4PluginResponseBuilderFunc): V4InteractionWithPluginResponse;
}
export declare class RequestWithPluginBuilder extends RequestBuilder implements V4RequestWithPluginBuilder {
pluginContents(contentType: string, contents: string): V4RequestWithPluginBuilder;
}
export declare class ResponseWithPluginBuilder extends ResponseBuilder implements V4ResponseWithPluginBuilder {
pluginContents(contentType: string, contents: string): V4ResponseBuilder;
}
export declare class InteractionWithPluginResponse implements V4InteractionWithPluginResponse {
private pact;
private opts;
protected cleanupFn: () => void;
constructor(pact: ConsumerPact, opts: PactV4Options, cleanupFn: () => void);
executeTest<T>(testFn: (mockServer: V4MockServer) => Promise<T>): Promise<T | undefined>;
}