UNPKG

@fantasticfiasco/expect

Version:

A Node.js library written in TypeScript providing argument validation.

52 lines (51 loc) 2.25 kB
/** * Expect a condition to be true. * @param condition The condition expected to be true. * @param errorMessage The optional error message displayed if expectation fails. * @throws {ExpectationError} */ export declare function toBeTrue(condition: boolean, errorMessage?: string): void; /** * Expect a condition to be false. * @param condition The condition expected to be false. * @param errorMessage The optional error message displayed if expectation fails. * @throws {ExpectationError} */ export declare function toBeFalse(condition: boolean, errorMessage?: string): void; /** * Expect a value to exist. * @param value The value expected to exist. * @param errorMessage The optional error message displayed if expectation fails. * @throws {ExpectationError} */ export declare function toExist<T>(value: T, errorMessage?: string): void; /** * Expect a value not to exist. * @param value The value expected not to exist. * @param errorMessage The optional error message displayed if expectation fails. * @throws {ExpectationError} */ export declare function toNotExist<T>(value: T, errorMessage?: string): void; /** * Expect a value to be alphanumeric. * @param value The value expected to be alphanumeric. * @param errorMessage The optional error message displayed if expectation fails. * @throws {ExpectationError} */ export declare function toBeAlphanumeric(value: string, errorMessage?: string): void; /** * Expect a value to only contain characters from a range of character codes. * @param value The value expected to have characters from a range of character codes. * @param minCharCode The expected minimum character code. * @param maxCharCode The expected maximum character code. * @param errorMessage The optional error message displayed if expectation fails. * @throws {ExpectationError} */ export declare function toBeCharCodes(value: string, minCharCode: number, maxCharCode: number, errorMessage?: string): void; /** * Expect a value to be an email. * @param email The value expected to be an email. * @param errorMessage The optional error message displayed if expectation fails. * @throws {ExpectationError} */ export declare function toBeEmail(email: string, errorMessage?: string): void;