UNPKG

@pact-foundation/pact

Version:
75 lines (74 loc) 4.51 kB
import type { ConsumerPact, AsynchronousMessage as PactCoreAsynchronousMessage } from '@pact-foundation/pact-core'; import type { AnyJson, JsonMap } from '../../common/jsonTypes'; import type { Metadata } from '../../dsl/message'; import type { Rules } from '../../v3/types'; import type { PactV4Options } from '../http/types'; import type { AsynchronousMessage, Comment, CustomComment, PluginConfig, TransportConfig, V4AsynchronousMessageBuilder, V4AsynchronousMessageBuilderFunc, V4AsynchronousMessageWithContent, V4AsynchronousMessageWithPlugin, V4AsynchronousMessageWithPluginContents, V4AsynchronousMessageWithTransport, V4UnconfiguredAsynchronousMessage } from './types'; type Message = { requestIsBinary: boolean; interaction: PactCoreAsynchronousMessage; }; export declare class UnconfiguredAsynchronousMessage implements V4UnconfiguredAsynchronousMessage { protected pact: ConsumerPact; protected interaction: PactCoreAsynchronousMessage; protected opts: PactV4Options; protected cleanupFn: () => void; protected message: Message; constructor(pact: ConsumerPact, interaction: PactCoreAsynchronousMessage, opts: PactV4Options, cleanupFn: () => void); expectsToReceive(description: string, builder: V4AsynchronousMessageBuilderFunc): AsynchronousMessageWithContent; given(state: string, parameters?: JsonMap): V4UnconfiguredAsynchronousMessage; pending(pending?: boolean): V4UnconfiguredAsynchronousMessage; comment(comment: Comment | CustomComment): V4UnconfiguredAsynchronousMessage; testName(name: string): V4UnconfiguredAsynchronousMessage; reference(group: string, name: string, value: string): V4UnconfiguredAsynchronousMessage; usingPlugin(config: PluginConfig): V4AsynchronousMessageWithPlugin; } export declare class AsynchronousMessageWithPlugin implements V4AsynchronousMessageWithPlugin { protected pact: ConsumerPact; protected message: Message; protected opts: PactV4Options; protected cleanupFn: () => void; constructor(pact: ConsumerPact, message: Message, opts: PactV4Options, cleanupFn: () => void); expectsToReceive(description: string): V4AsynchronousMessageWithPlugin; usingPlugin(config: PluginConfig): V4AsynchronousMessageWithPlugin; withPluginContents(contents: string, contentType: string): V4AsynchronousMessageWithPluginContents; } export declare class AsynchronousMessageBuilder implements V4AsynchronousMessageBuilder { protected pact: ConsumerPact; protected message: Message; protected opts: PactV4Options; constructor(pact: ConsumerPact, message: Message, opts: PactV4Options); withMetadata(metadata: Metadata): V4AsynchronousMessageBuilder; withContent(contentType: string, body: Buffer): V4AsynchronousMessageBuilder; withJSONContent(content: unknown): V4AsynchronousMessageBuilder; withMatchingRules(rules: Rules): V4AsynchronousMessageBuilder; } export declare class AsynchronousMessageWithContent implements V4AsynchronousMessageWithContent { protected pact: ConsumerPact; protected message: Message; protected opts: PactV4Options; protected cleanupFn: () => void; constructor(pact: ConsumerPact, message: Message, opts: PactV4Options, cleanupFn: () => void); executeTest<T>(integrationTest: (m: AsynchronousMessage) => Promise<T>): Promise<T | undefined>; } export declare class AsynchronousMessageWithPluginContents implements V4AsynchronousMessageWithPluginContents { protected pact: ConsumerPact; protected message: Message; protected opts: PactV4Options; protected cleanupFn: () => void; constructor(pact: ConsumerPact, message: Message, opts: PactV4Options, cleanupFn: () => void); executeTest<T>(integrationTest: (m: AsynchronousMessage) => Promise<T>): Promise<T | undefined>; startTransport(transport: string, address: string, // IP Address or hostname config?: AnyJson): V4AsynchronousMessageWithTransport; } export declare class AsynchronousMessageWithTransport implements V4AsynchronousMessageWithTransport { protected pact: ConsumerPact; protected message: Message; protected opts: PactV4Options; protected port: number; protected address: string; protected cleanupFn: () => void; constructor(pact: ConsumerPact, message: Message, opts: PactV4Options, port: number, address: string, cleanupFn: () => void); executeTest<T>(integrationTest: (tc: TransportConfig, m: AsynchronousMessage) => Promise<T>): Promise<T | undefined>; } export {};