From b5d2be3ab89eb3a8025c01cbb3a9162517946fd8 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Mon, 14 Mar 2022 13:07:46 +0100 Subject: [PATCH] fix(core): update --- ts/smartexpect.classes.assertion.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/ts/smartexpect.classes.assertion.ts b/ts/smartexpect.classes.assertion.ts index 492e870..34fbd1b 100644 --- a/ts/smartexpect.classes.assertion.ts +++ b/ts/smartexpect.classes.assertion.ts @@ -205,6 +205,30 @@ export class Assertion { }); } + public toStartWith(itemArg: any) { + return this.runCheck(() => { + const testObject = this.getObjectToTestReference(); + const result = + typeof testObject === 'string' && + testObject.startsWith(itemArg); + if (!result) { + throw new Error(`${this.baseReference} with drill down ${this.propertyDrillDown} is not contain ${itemArg}`); + } + }); + } + + public toEndWith(itemArg: any) { + return this.runCheck(() => { + const testObject = this.getObjectToTestReference(); + const result = + typeof testObject === 'string' && + testObject.endsWith(itemArg); + if (!result) { + throw new Error(`${this.baseReference} with drill down ${this.propertyDrillDown} is not contain ${itemArg}`); + } + }); + } + public property(propertyNameArg: string) { this.propertyDrillDown.push(propertyNameArg); return this;