feat(assertion): Add toBeDefined assertion method
This commit is contained in:
@ -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') {
|
||||
|
Reference in New Issue
Block a user