Compare commits

..

2 Commits

Author SHA1 Message Date
3bd650dc2c 1.0.7 2022-01-21 19:40:31 +01:00
71cecfdc9a fix(core): update 2022-01-21 19:40:30 +01:00
3 changed files with 30 additions and 3 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@pushrocks/smartexpect",
"version": "1.0.6",
"version": "1.0.7",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@pushrocks/smartexpect",
"version": "1.0.6",
"version": "1.0.7",
"license": "MIT",
"dependencies": {
"@pushrocks/smartdelay": "^2.0.13",

View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartexpect",
"version": "1.0.6",
"version": "1.0.7",
"private": false,
"description": "manage expectations in code",
"main": "dist_ts/index.js",

View File

@ -100,4 +100,31 @@ export class Assertion {
}
});
}
public toBeTrue() {
return this.runCheck(() => {
const result = typeof this.baseReference === 'boolean' && this.baseReference === true;
if (!result) {
throw new Error(`${this.baseReference} is not true or not of type boolean`);
}
});
}
public toBeFalse() {
return this.runCheck(() => {
const result = typeof this.baseReference === 'boolean' && this.baseReference === false;
if (!result) {
throw new Error(`${this.baseReference} is not false or not of type boolean`);
}
});
}
public toBeInstanceOf(classArg: any) {
return this.runCheck(() => {
const result = this.baseReference instanceof classArg;
if (!result) {
throw new Error(`${this.baseReference} is not an instance of ${classArg}`);
}
});
}
}