UNPKG

@contract-case/case-core

Version:

Core functionality for the ContractCase contract testing suite

39 lines 2.2 kB
import { Mutex } from 'async-mutex'; import { AnyMockDescriptorType } from '@contract-case/case-entities-internal'; import { MatchContext, CaseExample } from '@contract-case/case-plugin-base'; import { BaseCaseContract } from './BaseCaseContract'; import type { MultiTestInvoker, RunTestCallback } from './executeExample/types'; import type { CaseConfig } from './config/types'; import { DownloadedContract, ReaderDependencies } from './types'; export declare class ReadingCaseContract extends BaseCaseContract { private mutex; private makeBrokerService; private links; private status; /** * Constructs a ReadingCaseContract * * @param contractFile - The DownloadedContract to verify * @param readerDependencies - The dependencies for a contract reader (injected) * @param config - the CaseConfig for this run * @param parentVersions - the array of versions of all the ContractCase packages before this one * @param mutex - a Mutex to use to ensure that only one test is run at once. * this is injected, since the parent class might make more than one * ReadingCaseContract objects (if verifying multiple contracts), but only one interaction can be run at once. */ constructor(contractFile: DownloadedContract, { resultFormatter: resultPrinter, makeLogger, defaultConfig, makeBrokerService, }: ReaderDependencies, config: CaseConfig, parentVersions: string[], mutex: Mutex); /** * Verifies this contract * * @param invoker - The invoker for this test * @param runTestCb - a callback to tell the test framework that we're running a test * @returns a Promise if the verification if asyncVerification is set, * otherwise undefined. Note that if asyncVerification is false, this method * returns before the verification has finished, leaving it up to the test * callbacks. */ verifyContract<T extends AnyMockDescriptorType>(invoker: MultiTestInvoker<T>, runTestCb: RunTestCallback): Promise<void> | undefined; recordExample(example: CaseExample, currentContext: MatchContext): CaseExample; endRecord(): Promise<void>; } //# sourceMappingURL=ReadingCaseContract.d.ts.map