feat(assertion): Add toBeDefined assertion method

This commit is contained in:
2024-08-17 07:27:32 +02:00
parent 537545766c
commit 9ef1e5120e
5 changed files with 3920 additions and 2742 deletions

View File

@ -71,6 +71,22 @@ export class Assertion {
}
}
/**
* checks if the given object is defined
*/
public toBeDefined() {
return this.runCheck(() => {
if (this.getObjectToTestReference() === undefined) {
throw new Error(
`${this.baseReference} with drill down ${this.propertyDrillDown} is not defined`
);
}
});
}
/**
* checks if the given object is not defined
*/
public toBeTypeofString() {
return this.runCheck(() => {
if (typeof this.getObjectToTestReference() !== 'string') {