@case-contract-testing/case
Version:
Next-generation contract testing suite
38 lines (37 loc) • 1.99 kB
TypeScript
import { type CoreStringContainsMatcher, type AnyCaseMatcher, type CoreStringPrefixMatcher, type CoreStringSuffixMatcher, CoreBase64Encoded, AnyStringMatcher, AnyCaseNodeOrData, CoreJsonStringified } from '../../../entities/types';
/**
* Matches any string that contains the given substring.
*
* @param substring - The substring that the matcher must contain
* @param example - An example string that passes this matcher
*/
export declare const stringContaining: (substring: string, example: string) => CoreStringContainsMatcher;
/**
* Matches any string that begins with the given constant string prefix
*
* @param prefix - The prefix string. Must be a string and not a matcher
* @param suffix - An optional string or matcher to match against the suffix
*/
export declare const stringPrefix: (prefix: string, suffix?: AnyCaseMatcher | string) => CoreStringPrefixMatcher;
/**
* Matches any string that ends with the given constant string suffix
*
* @param prefix - A string or matcher to match against the prefix. If you don't mind what the prefix is, pass `anyString()`
* @param suffix - The suffix string. Must be a string and not a matcher
*/
export declare const stringSuffix: (prefix: AnyCaseMatcher | string, suffix: string) => CoreStringSuffixMatcher;
/**
* Matches any string that matches a base64 encoded version of the given string or string matcher
*
* WARNING: Since many strings are accidentally decodable as base64, this matcher is
* best combined with a more restrictive string matcher (eg stringifiedJson()).
*
* @param child - The string or string matcher to match against
*/
export declare const encodedStringBase64: (child: AnyStringMatcher) => CoreBase64Encoded;
/**
* Matches any string that matches a JSON.stringify()ed version of the given object (which may itself contain matchers)
*
* @param child - The string or string matcher to match against
*/
export declare const stringifiedJson: (child: AnyCaseNodeOrData) => CoreJsonStringified;