@contract-case/case-plugin-base
Version:
Plugin framework for writing plugins for the ContractCase test framework
50 lines • 2.16 kB
TypeScript
import { AnyCaseMatcherOrData } from '@contract-case/case-plugin-dsl-types';
import { MatchContext } from '../context/types';
/**
* During a matcher execution, this function can be called to ensure that the
* provided matcher resolves to a string when stripped with `stripMatchers`.
*
* @remarks
*
* Use it if you expect that it's not possible for the matcher to
* resolve to anything other than a string, as it throws a
* {@link CaseConfigurationError}.
*
* If you use this function during a `check` operation, then the
* `CaseConfigurationError` will ultimately become a `CaseCoreError`, because
* it's not supposed to be possible to throw exceptions from a `check`
*
* If you're using it in `check`, make sure you also call it in `validate`.
*
* @public
*
* @param matcher - any matcher descriptor or data object
* @param context - the current {@link MatchContext}
* @returns the string value that the matcher resolves to
* @throws a {@link CaseConfigurationError} if the matcher doesn't resolve to a string.
*/
export declare const mustResolveToString: (matcher: AnyCaseMatcherOrData, context: MatchContext) => string;
/**
* During a matcher execution, this function can be called to ensure that the
* provided matcher resolves to number.
*
* @remarks
*
* Use it if you expect that it's not possible for the matcher to
* resolve to anything other than a number, as it throws a
* {@link CaseConfigurationError}.
*
* If you use this function during a `check` operation, then the
* `CaseConfigurationError` will ultimately become a `CaseCoreError`, because
* it's not supposed to be possible to throw exceptions from a `check`
*
* If you're using it in `check`, make sure you also call it in `validate`.
* @public
*
* @param matcher - any matcher descriptor or data object
* @param context - the current {@link MatchContext}
* @returns the number value that the matcher resolves to
* @throws a {@link CaseConfigurationError} if the matcher doesn't resolve to a number.
*/
export declare const mustResolveToNumber: (matcher: AnyCaseMatcherOrData, context: MatchContext) => number;
//# sourceMappingURL=resolve.d.ts.map