import { InternalContractCaseCoreSetup } from '@contract-case/case-plugin-dsl-types'; /** * This type defines the core behaviour that ContractCase has with this mock. * * If you are using the included example types from ContractCase (or any * extension libraries), you do not need to use this class (or understand this * documentation). * * This documentation is only necessary for people extending ContractCase to include * new mock types. * * See the definitions in the case-entities-internal package for more details. * @public */ export interface ContractCaseCoreBehaviour { /** * The type of this mock. Usually this is inverted on read vs write, for * example, a written MOCK_HTTP_CLIENT might become a MOCK_HTTP_SERVER during * reading. * * This will almost always be the same as the top level type for your mock * during read - but if it is different, ContractCase will respect this value. */ readonly mockType: string; /** * Whether or not this mock mode will invoke state handlers. If set to * `"default"` then ContractCase will not invoke or require the state handlers * and will use the default values for all state variables. If set to `"state"`, * then ContractCase will invoke the state handlers and require the expected variables to * be returned. * * All other values are errors. */ readonly stateVariables: string; /** * Whether or not this mock mode needs to be triggered by user-provided code. * If `"provided"` then ContractCase will require the user to provide a * trigger and a test function (eg, for testing an HTTP Client, code that will * invoke it must be provided). If `"generated"`, then ContractCase will not * require user provided triggers as it will generate them (eg, if the * system under test is an HTTP server, ContractCase will generate client calls). */ readonly triggers: string; } /** * @public */ export interface ContractCaseCoreSetup { /** * Defines how the ContractCase core will behave when writing (ie, defining) an interaction of this type. */ readonly write: ContractCaseCoreBehaviour; /** * Defines how the ContractCase core will behave when reading (ie, verifying) a interaction of this type. */ readonly read: ContractCaseCoreBehaviour; } /** * The base class for all ContractCase Mock Descriptors. Extend this if you are * implementing your own mock type. * * If you are using the included example types from ContractCase (or any * extension libraries), you do not need to read the documentation for this * class. * * Mock description type strings beginning with `_case:` are reserved for the default ContractCase * matchers. Only use a types prefixed with `_case:` if you wish to create a DSL for a special case * for a matching behaviour that is already provided by a core ContractCase mock. * * @public */ export declare abstract class AnyInteractionDescriptor { /** @internal */ readonly '_case:mock:type': string; /** @internal */ readonly '_case:run:context:setup': InternalContractCaseCoreSetup; /** * The base class for all ContractCase Mock Descriptors. Extend this if you are * implementing your own mock type. * * If you are using the included example types from ContractCase (or any * extension libraries), you do not need to read the documentation for this * class. * * Mock description type strings beginning with `_case:` are reserved for the default ContractCase * matchers. Only use a types prefixed with `_case:` if you wish to create a DSL for a special case * for a matching behaviour that is already provided by a core ContractCase mock. * * @param mockType - The type string for this mock description (see [Extending ContractCase](https://case.contract-testing.io/docs/reference/plugin-framework) for a description of these strings). * * */ constructor(mockType: string, setup: ContractCaseCoreSetup); /** * Only override this method if you are writing a matcher in a language other than TypeScript. * * It exists because the ContractCase matcher format is not legal in all languages that ContractCase supports. * * It isn't called by any implementation directly, it's used on the javascript side by `JSON.stringify()`. * * Calling it from a wrapper library will return unhelpful results, as JSii can't map all objects that it returns. * * WARNING: Do not return a string from this method. You must instead return * an object that can be serialised to JSON following the matcher format * described in [Extending ContractCase](https://case.contract-testing.io/docs/reference/plugin-framework). * * @returns An object in the matcher format described [in the Extending ContractCase documentation](https://case.contract-testing.io/docs/reference/plugin-framework). */ toJSON(): unknown; /** * This method returns the entire example as a JSON string, as a convenience * so that wrapper libraries don't need to figure out how to walk a tree of example objects. * * You shouldn't need to override this method. * * @returns A JSON string representation of this mock. */ stringify(): string; } //# sourceMappingURL=AnyInteractionDescriptor.d.ts.map