@push.rocks/smartexpect
Version:
A testing library to manage expectations in code, offering both synchronous and asynchronous assertion methods.
32 lines (31 loc) • 1.75 kB
TypeScript
import { Assertion } from '../smartexpect.classes.assertion.js';
import type { TExecutionType } from '../types.js';
/**
* Namespace for object-specific matchers
*/
export declare class ObjectMatchers<T extends object, M extends TExecutionType> {
private assertion;
constructor(assertion: Assertion<T, M>);
toEqual(expected: any): M extends "async" ? Promise<Assertion<T, M>> : Assertion<T, M>;
toMatchObject(expected: object): M extends "async" ? Promise<Assertion<T, M>> : Assertion<T, M>;
toBeInstanceOf(constructor: any): M extends "async" ? Promise<Assertion<T, M>> : Assertion<T, M>;
toHaveProperty(property: string, value?: any): M extends "async" ? Promise<Assertion<T, M>> : Assertion<T, M>;
toHaveDeepProperty(path: string[]): M extends "async" ? Promise<Assertion<T, M>> : Assertion<T, M>;
toBeNull(): M extends "async" ? Promise<Assertion<T, M>> : Assertion<T, M>;
toBeUndefined(): M extends "async" ? Promise<Assertion<T, M>> : Assertion<T, M>;
toBeNullOrUndefined(): M extends "async" ? Promise<Assertion<T, M>> : Assertion<T, M>;
/**
* Checks own property only (not inherited)
*/
toHaveOwnProperty(property: string, value?: any): M extends "async" ? Promise<Assertion<T, M>> : Assertion<T, M>;
/**
* Assert object has the given keys (including inherited properties).
* @param keys Array of keys to check for presence.
*/
toHaveKeys(keys: string[]): M extends "async" ? Promise<Assertion<T, M>> : Assertion<T, M>;
/**
* Assert object has the given own keys (excluding inherited properties).
* @param keys Array of own keys to check.
*/
toHaveOwnKeys(keys: string[]): M extends "async" ? Promise<Assertion<T, M>> : Assertion<T, M>;
}