39 lines
896 B
TypeScript
39 lines
896 B
TypeScript
|
import { Assertion } from '../smartexpect.classes.assertion.js';
|
||
|
|
||
|
/**
|
||
|
* Namespace for object-specific matchers
|
||
|
*/
|
||
|
export class ObjectMatchers<T extends object> {
|
||
|
constructor(private assertion: Assertion<T>) {}
|
||
|
|
||
|
toEqual(expected: any) {
|
||
|
return this.assertion.toEqual(expected);
|
||
|
}
|
||
|
|
||
|
toMatchObject(expected: object) {
|
||
|
return this.assertion.toMatchObject(expected);
|
||
|
}
|
||
|
|
||
|
toBeInstanceOf(constructor: any) {
|
||
|
return this.assertion.toBeInstanceOf(constructor);
|
||
|
}
|
||
|
|
||
|
toHaveProperty(property: string, value?: any) {
|
||
|
return this.assertion.toHaveProperty(property, value);
|
||
|
}
|
||
|
|
||
|
toHaveDeepProperty(path: string[]) {
|
||
|
return this.assertion.toHaveDeepProperty(path);
|
||
|
}
|
||
|
toBeNull() {
|
||
|
return this.assertion.toBeNull();
|
||
|
}
|
||
|
|
||
|
toBeUndefined() {
|
||
|
return this.assertion.toBeUndefined();
|
||
|
}
|
||
|
|
||
|
toBeNullOrUndefined() {
|
||
|
return this.assertion.toBeNullOrUndefined();
|
||
|
}
|
||
|
}
|