@qavajs/validation
Version:
Lib that transform plain english definition to validation functions
48 lines (47 loc) • 1.37 kB
TypeScript
import { expect } from './matchers';
export declare const validations: {
EQUAL: string;
DEEPLY_EQUAL: string;
STRICTLY_EQUAL: string;
HAVE_MEMBERS: string;
MATCH: string;
CONTAIN: string;
ABOVE: string;
BELOW: string;
GREATER: string;
LESS: string;
HAVE_TYPE: string;
INCLUDE_MEMBERS: string;
HAVE_PROPERTY: string;
MATCH_SCHEMA: string;
CASE_INSENSITIVE_EQUAL: string;
SATISFY: string;
};
export declare const validationExtractRegexp: RegExp;
export declare const validationRegexp: RegExp;
type VerifyInput = {
received: any;
expected: any;
validation: string;
reverse: boolean;
soft: boolean;
};
/**
* Basic verification function
* @param {VerifyInput} object with all needed data for validation
*/
export declare function verify({ received, expected, validation, reverse, soft }: VerifyInput): void;
export declare function getValidation(validationType: string, options?: {
soft: boolean;
}): (AR: any, expected: any) => void;
export declare function getPollValidation(validationType: string, options?: {
soft: boolean;
}): (AR: any, expected: any, options?: {
timeout?: number;
interval?: number;
}) => Promise<unknown>;
export declare function poll(fn: Function, options?: {
timeout?: number;
interval?: number;
}): Promise<unknown>;
export { expect };