/** * This module contains a series of matchers, that is, a series of functions * that can be called with the actual value (and in cases a series of arguments) * and returns a boolean, `true` if the value satisfies the matcher, and `false` * otherwise. * * @remarks * Having the matchers separated from the instances that use the matchers allow for * greater extensibility. * * @module Expectations/Matchers * @author Alan Rodas Bonjour */ import { Shape } from '../Functions'; /** * A matcher call represents a call to a matcher with it's corresponding * arguments and the actual result. * */ export interface MatcherCall { matcher: string; args: unknown[]; result: boolean; } /** Answers if the actual value is the same as expected, using strict compare */ export declare const toBe: (actual: unknown, expected: unknown) => boolean; /** Answers if the actual value is the same as expected, using a deep compare mechanism */ export declare const toBeLike: (actual: unknown, expected: unknown) => boolean; /** Answers if the actual value is defined (as in not equal to undefined) */ export declare const toBeDefined: (actual: unknown) => boolean; /** Answers if the actual value is undefined */ export declare const toBeUndefined: (actual: unknown) => boolean; /** Answers if the actual value is null (strict null, not undefined) */ export declare const toBeNull: (actual: unknown) => boolean; /** Answers if the actual value is a truthy value */ export declare const toBeTruthy: (actual: unknown) => boolean; /** Answers if the actual value is a falsy value */ export declare const toBeFalsy: (actual: unknown) => boolean; /** * Answers if the actual value has a type matching the expected type, * checked by using the typeof operator. * * @example `toHaveType('hello', 'string')` returns `true`. */ export declare const toHaveType: (actual: unknown, expectedType: string) => boolean; /** * Answer if the actual element has the given shape, as defined by * the shapeOf submodule. */ export declare const toHaveShape: (actual: unknown, shape: Shape) => boolean; /** Answers if the actual value is true */ export declare const toBeTrue: (actual: unknown) => boolean; /** Answers if the actual value is false */ export declare const toBeFalse: (actual: unknown) => boolean; /** Answer if the actual value is greater than the expected value. */ export declare const toBeGreaterThan: (actual: number, expected: number) => boolean; /** Answer if the actual value is greater than or equal than the expected value. */ export declare const toBeGreaterThanOrEqual: (actual: number, expected: number) => boolean; /** Answer if the actual value is lower than the expected value. */ export declare const toBeLowerThan: (actual: number, expected: number) => boolean; /** Answer if the actual value is lower than or equal than the expected value. */ export declare const toBeLowerThanOrEqual: (actual: number, expected: number) => boolean; /** Answer if the actual value is between the from and to values (inclusive). */ export declare const toBeBetween: (actual: number, from: number, to: number) => boolean; /** Answer if the actual value is infinity (positive or negative). */ export declare const toBeInfinity: (actual: number) => boolean; /** Answer if the actual value is not a number. */ export declare const toBeNaN: (actual: number) => boolean; /** * Answer if the actual value is close to the expected value, by at least the number * of digits given. * @example `toBeCloseTo(4.0005, 4.0009, 3)` returns `true`, as there are 3 * digits that are equal between actual and expected. * If no amount of digits is given, 5 is taken by default. */ export declare const toBeCloseTo: (actual: number, expected: number, numDigits: number) => boolean; /** Answer if the actual value has expected as a substring. */ export declare const toHaveSubstring: (actual: string, expected: string) => boolean; /** Answer if the actual value starts with the expected string. */ export declare const toStartWith: (actual: string, expected: string) => boolean; /** Answer if the actual value ends with the expected string. */ export declare const toEndWith: (actual: string, expected: string) => boolean; /** Answer if the actual value matches the given regexp. */ export declare const toMatch: (actual: string, expected: RegExp) => boolean; export declare const toBeEmptyArray: (actual: unknown) => boolean; /** Answer if the actual value has a length of expected number. */ export declare const toHaveLength: (actual: unknown[], expected: number) => boolean; /** Answer if the actual value contains the expected element. */ export declare const toContain: (actual: unknown[], expected: unknown) => boolean; /** * Answer if the actual value has a the expected element at a given position. * Returns false if the position does not exist. */ export declare const toHaveAtPosition: (actual: unknown[], expected: unknown, position: number) => boolean; /** Answer if all the element of the actual value satisfy a given criteria. */ export declare const allToSatisfy: (actual: unknown[], criteria: (elem: unknown) => boolean) => boolean; /** Answer if any of the element of the actual value satisfy a given criteria. */ export declare const anyToSatisfy: (actual: unknown[], criteria: (elem: unknown) => boolean) => boolean; /** Answer if a given amount of elements of the actual value satisfy a given criteria. */ export declare const amountToSatisfy: (actual: unknown[], amount: number, criteria: (elem: unknown) => boolean) => boolean; /** Answer if the actual value is empty. */ export declare const toBeEmptyObject: (actual: unknown) => boolean; /** Answer if the actual element has the given amount of properties. */ export declare const toHavePropertyCount: (actual: unknown, amount: number) => boolean; /** Answer if an object has at least all keys in the least. Combine with * toHaveNoOtherThan to ensure exact key existence */ export declare const toHaveAtLeast: (actual: unknown, keys: string[]) => boolean; /** Answer if an object has no other than the given keys (although not all given * need to be present). Combine with toHaveAtLeast to ensure exact key existence */ export declare const toHaveNoOtherThan: (actual: unknown, keys: string[]) => boolean; /** Answer if the actual element has a property with the given name. */ export declare const toHaveProperty: (actual: unknown, propertyName: string) => boolean; /** Answer if the actual element is an instance of a given class (using instanceof). */ export declare const toBeInstanceOf: (actual: unknown, classConstructor: (...arguments_: readonly unknown[]) => unknown) => boolean; //# sourceMappingURL=Matchers.d.ts.map