UNPKG

@pact-foundation/pact

Version:
78 lines (77 loc) 5.16 kB
import { Metadata } from '../../dsl/message'; import { AnyJson, JsonMap } from '../../common/jsonTypes'; import { PluginConfig, SynchronousMessage, TransportConfig, V4MessagePluginRequestBuilderFunc, V4MessagePluginResponseBuilderFunc, V4SynchronousMessageWithPlugin, V4SynchronousMessageWithPluginContents, V4SynchronousMessageWithRequest, V4SynchronousMessageWithRequestBuilder, V4SynchronousMessageWithResponse, V4SynchronousMessageWithResponseBuilder, V4SynchronousMessageWithTransport, V4UnconfiguredSynchronousMessage } from './types'; import { SynchronousMessage as PactCoreSynchronousMessage, ConsumerPact } from '@pact-foundation/pact-core'; import { PactV4Options } from '../http/types'; export declare class UnconfiguredSynchronousMessage implements V4UnconfiguredSynchronousMessage { protected pact: ConsumerPact; protected interaction: PactCoreSynchronousMessage; protected opts: PactV4Options; protected cleanupFn: () => void; constructor(pact: ConsumerPact, interaction: PactCoreSynchronousMessage, opts: PactV4Options, cleanupFn: () => void); given(state: string, parameters?: JsonMap): V4UnconfiguredSynchronousMessage; usingPlugin(config: PluginConfig): V4SynchronousMessageWithPlugin; withRequest(r: V4MessagePluginRequestBuilderFunc): V4SynchronousMessageWithRequest; } export declare class SynchronousMessageWithPlugin implements V4SynchronousMessageWithPlugin { protected pact: ConsumerPact; protected interaction: PactCoreSynchronousMessage; protected opts: PactV4Options; protected cleanupFn: () => void; constructor(pact: ConsumerPact, interaction: PactCoreSynchronousMessage, opts: PactV4Options, cleanupFn: () => void); usingPlugin(config: PluginConfig): V4SynchronousMessageWithPlugin; withPluginContents(contents: string, contentType: string): V4SynchronousMessageWithPluginContents; } export declare class SynchronousMessageWithRequestBuilder implements V4SynchronousMessageWithRequestBuilder { protected pact: ConsumerPact; protected interaction: PactCoreSynchronousMessage; protected opts: PactV4Options; constructor(pact: ConsumerPact, interaction: PactCoreSynchronousMessage, opts: PactV4Options); withContent(contentType: string, body: Buffer): V4SynchronousMessageWithRequestBuilder; withJSONContent(content: unknown): V4SynchronousMessageWithRequestBuilder; } export declare class SynchronousMessageWithRequest implements V4SynchronousMessageWithRequest { protected pact: ConsumerPact; protected interaction: PactCoreSynchronousMessage; protected opts: PactV4Options; protected cleanupFn: () => void; constructor(pact: ConsumerPact, interaction: PactCoreSynchronousMessage, opts: PactV4Options, cleanupFn: () => void); withResponse(builder: V4MessagePluginResponseBuilderFunc): V4SynchronousMessageWithResponse; } export declare class SynchronousMessageWithResponseBuilder implements V4SynchronousMessageWithResponseBuilder { protected pact: ConsumerPact; protected interaction: PactCoreSynchronousMessage; protected opts: PactV4Options; constructor(pact: ConsumerPact, interaction: PactCoreSynchronousMessage, opts: PactV4Options); withMetadata(metadata: Metadata): V4SynchronousMessageWithResponseBuilder; withContent(contentType: string, body: Buffer): V4SynchronousMessageWithResponseBuilder; withJSONContent(content: unknown): V4SynchronousMessageWithResponseBuilder; } export declare class SynchronousMessageWithPluginContents implements V4SynchronousMessageWithPluginContents { protected pact: ConsumerPact; protected interaction: PactCoreSynchronousMessage; protected opts: PactV4Options; protected cleanupFn: () => void; constructor(pact: ConsumerPact, interaction: PactCoreSynchronousMessage, opts: PactV4Options, cleanupFn: () => void); executeTest<T>(integrationTest: (m: SynchronousMessage) => Promise<T>): Promise<T | undefined>; startTransport(transport: string, address: string, // IP Address or hostname config?: AnyJson): V4SynchronousMessageWithTransport; } export declare class SynchronousMessageWithTransport implements V4SynchronousMessageWithTransport { protected pact: ConsumerPact; protected interaction: PactCoreSynchronousMessage; protected opts: PactV4Options; protected port: number; protected address: string; protected cleanupFn: () => void; constructor(pact: ConsumerPact, interaction: PactCoreSynchronousMessage, opts: PactV4Options, port: number, address: string, cleanupFn: () => void); executeTest<T>(integrationTest: (tc: TransportConfig, m: SynchronousMessage) => Promise<T>): Promise<T | undefined>; } export declare class SynchronousMessageWithResponse implements V4SynchronousMessageWithResponse { protected pact: ConsumerPact; protected interaction: PactCoreSynchronousMessage; protected opts: PactV4Options; protected cleanupFn: () => void; constructor(pact: ConsumerPact, interaction: PactCoreSynchronousMessage, opts: PactV4Options, cleanupFn: () => void); executeTest<T>(integrationTest: (m: SynchronousMessage) => Promise<T>): Promise<T | undefined>; }