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}`); }