UNPKG

@contract-case/case-core

Version:

Core functionality for the ContractCase contract testing suite

33 lines 2.5 kB
import { AllMockSetupInfos, AnyCaseMatcher, AnyMockDescriptor, AnyMockDescriptorType } from '@contract-case/case-entities-internal'; import { CaseMockDescriptorFor, AnyData, AnyLeafOrStructure, SetupInfoFor, AnyState } from '@contract-case/case-plugin-dsl-types'; import { WritingCaseContract } from '../../core'; import type { MultiTestInvoker, Trigger } from '../../core/executeExample/types'; import type { CaseConfig, ContractWriteSuccess } from '../../core/types'; import { TestPrinter } from './types'; import { CaseContractDescription } from '../../entities/types'; export type DefinitionSuccessExample<T extends AnyMockDescriptorType, R = unknown, MockSetups = AllMockSetupInfos> = MultiTestInvoker<T, R> & { states?: Array<AnyState>; definition: CaseMockDescriptorFor<AnyMockDescriptor, T>; trigger?: Trigger<T, R>; testResponse?: (data: R, config: SetupInfoFor<MockSetups, T>) => unknown; triggerAndTest?: Trigger<T>; }; export type DefinitionFailingExample<T extends AnyMockDescriptorType, R = unknown, MockSetups = AllMockSetupInfos> = MultiTestInvoker<T, R> & { states?: Array<AnyState>; definition: CaseMockDescriptorFor<AnyMockDescriptor, T>; trigger?: Trigger<T, R>; triggerAndTest?: Trigger<T>; testErrorResponse?: (err: Error, config: SetupInfoFor<MockSetups, T>) => unknown; }; export declare class ContractDefinerConnector<M extends AnyMockDescriptorType> { contract: WritingCaseContract; invoker: MultiTestInvoker<M>; config: CaseConfig; constructor(description: CaseContractDescription, config: CaseConfig, invoker: MultiTestInvoker<M>, printer: TestPrinter, parentVersions: string[], dependencies?: import("../../core/types").WriterDependencies); registerFunction(handle: string, invokeableFn: (...args: unknown[]) => Promise<unknown | void>): void; runInteraction<T extends AnyMockDescriptorType, R>({ states, definition, trigger, triggers, triggerAndTest, triggerAndTests, testResponse, stateHandlers, }: DefinitionSuccessExample<T, R>, runConfig?: CaseConfig): Promise<unknown>; runRejectingInteraction<T extends AnyMockDescriptorType, R>({ states, definition, trigger, triggers, triggerAndTest, triggerAndTests, testErrorResponse, stateHandlers, }: DefinitionFailingExample<T, R>, runConfig?: CaseConfig): Promise<unknown>; endRecord(): Promise<ContractWriteSuccess>; stripMatchers(matcherOrData: AnyCaseMatcher | AnyLeafOrStructure): AnyData; } //# sourceMappingURL=ContractDefinerConnector.d.ts.map