import { Assertion } from "./Assertion"; import { Entry, Struct } from "./helpers/types"; /** * Encapsulates assertion methods applicable to objects. * * @param T the object's definition type */ export declare class ObjectAssertion extends Assertion { constructor(actual: T); private hasOwnProp; /** * Check if the object is empty. That is, when the object doesn't have any * properties. * * @example * ``` * expect({}).toBeEmpty(); * ``` * * @returns the assertion instance */ toBeEmpty(): this; /** * Check if the object contains the provided key. * * @example * ``` * expect({ a: 1, b: 2 }).toContainKey("a"); * ``` * * @param key the key that the object should contain * @returns the assertion instance */ toContainKey(key: keyof T): this; /** * Check if the object contains the all provided keys. * * @example * ``` * expect({ a: 1, b: 2, c: 3 }).toContainAllKeys("a", "b"); * ``` * * @param keys the keys that the object should contain * @returns the assertion instance */ toContainAllKeys(...keys: Array): this; /** * Check if the object contains at least one of the provided keys. * * @example * ``` * expect({ a: 1, b: 2, c: 3 }).toContainAnyKeys("a", "b"); * ``` * * @param keys the keys that the object may contain * @returns the assertion instance */ toContainAnyKeys(...keys: Array): this; /** * Check if the object has exactly the provided keys. * * @example * ``` * expect({ x: 1, y: 2, z: 3 }).toHaveKeys("x", "y", "z"); * ``` * * @param keys the keys the object should have * @returns the assertion instance */ toHaveKeys(...keys: Array): this; /** * Check if the object contains the provided value. * * @example * ``` * expect({ a: 1, b: 2, c: 3 }).toContainValue(2); * ``` * * @param value the property value that the object should contain in any of * its keys * @returns the assertion instance */ toContainValue(value: T[keyof T]): this; /** * Check if the object contains all the provided values. * * @example * ``` * expect({ a: 1, b: 2, c: 3 }).toContainAllValues(1, 2); * ``` * * @param values the property values that the object should contain * @returns the assertion instance */ toContainAllValues(...values: Array): this; /** * Check if the object contains at least one of the provided values. * * @example * ``` * expect({ a: 1, b: 2, c: 3 }).toContainAnyValues(1, 5, 7); * ``` * * @param values the property values that the object should contain * @returns the assertion instance */ toContainAnyValues(...values: Array): this; /** * Check if the object has exactly the provided values. * * @example * ``` * expect({ x: 1, y: "a", z: true }).toHaveValues(1, "a", true); * ``` * * @param values the values the object should have * @returns the assertion instance */ toHaveValues(...values: Array): this; /** * Check if the object contains the provided entry. * * @example * ``` * expect({ a: 1, b: 2, c: 3 }).toContainEntry(["a", 1]); * ``` * * @param entry the entry that the object should contain * @returns the assertion instance */ toContainEntry(entry: Entry): this; /** * Check if the object contains all the provided entries. * * @example * ``` * expect({ a: 1, b: 2, c: 3 }).toContainAllEntries(["a", 1], ["b", 2]); * ``` * * @param entries the entries that the object should contain * @returns the assertion instance */ toContainAllEntries(...entries: Entry[]): this; /** * Check if the object contains at least one of the provided entries. * * @example * ``` * expect({ a: 1, b: 2, c: 3 }) * .toContainAnyEntries(["a", 1], ["b", 9], ["c", 20]); * ``` * * @param entries the entries that the object should contain * @returns the assertion instance */ toContainAnyEntries(...entries: Entry[]): this; /** * Check if the object has exactly the provided entries. * * @example * ``` * expect({ a: 1, b: 2, c: 3 }) * .toHaveEntries(["a", 1], ["b", 2], ["c", 3]); * ``` * * @param entries the entries the object should have * @returns the assertion instance */ toHaveEntries(...entries: Entry[]): this; /** * Check if the object match the provided object. * * @example * ``` * expect({ a: 1, b: 2, c: 3 }).toPartiallyMatch({ b: 2, c: 3 }); * ``` * * @param other the object that the object should match * @returns the assertion instance */ toPartiallyMatch(other: Partial): this; }