@contract-case/case-core
Version:
Core functionality for the ContractCase contract testing suite
39 lines • 2.09 kB
TypeScript
import { CoreStringContainsMatcher, AnyCaseMatcher, CoreStringPrefixMatcher, CoreStringSuffixMatcher, CoreBase64EncodedMatcher, CoreJsonStringifiedMatcher } from '@contract-case/case-entities-internal';
import { AnyCaseMatcherOrData } from '@contract-case/case-plugin-dsl-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: AnyCaseMatcher) => CoreBase64EncodedMatcher;
/**
* 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: AnyCaseMatcherOrData) => CoreJsonStringifiedMatcher;
//# sourceMappingURL=strings.d.ts.map