From 9213e7905f5d3fe32eccb94162dc9a5ac44e0eb8 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Wed, 2 Feb 2022 08:02:26 +0100 Subject: [PATCH] fix(core): update --- test/test.ts | 8 ++++++++ ts/smartexpect.classes.assertion.ts | 4 +--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/test/test.ts b/test/test.ts index e78ad48..7508258 100644 --- a/test/test.ts +++ b/test/test.ts @@ -36,4 +36,12 @@ tap.test('should be greater than', async () => { smartexpect.expect(4).toBeLessThan(5); }) +tap.test('should correctly determine toContain', async () => { + const hello = { + socool: 'yes' + }; + const testArray = [hello]; + smartexpect.expect(testArray).toContain(hello); +}) + tap.start(); diff --git a/ts/smartexpect.classes.assertion.ts b/ts/smartexpect.classes.assertion.ts index aab833e..2369ff2 100644 --- a/ts/smartexpect.classes.assertion.ts +++ b/ts/smartexpect.classes.assertion.ts @@ -189,9 +189,7 @@ export class Assertion { return this.runCheck(() => { const result = this.baseReference instanceof Array && - this.baseReference.find((itemArg2) => { - itemArg === itemArg2; - }); + this.baseReference.includes(itemArg); if (!result) { throw new Error(`${this.baseReference} is not contain ${itemArg}`); }