From 71cecfdc9abcf23cd9b17edcb098cee74e769188 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Fri, 21 Jan 2022 19:40:30 +0100 Subject: [PATCH] fix(core): update --- ts/smartexpect.classes.assertion.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/ts/smartexpect.classes.assertion.ts b/ts/smartexpect.classes.assertion.ts index e0a211e..9430831 100644 --- a/ts/smartexpect.classes.assertion.ts +++ b/ts/smartexpect.classes.assertion.ts @@ -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}`); + } + }); + } }