From 569ba439a260924a15a2109c6ca40cd36c30a554 Mon Sep 17 00:00:00 2001 From: "void." <138296610+mohammednumaan@users.noreply.github.com> Date: Fri, 17 Jan 2025 10:49:07 +0530 Subject: [PATCH] chore: fix lint issues. --- packages/expect/src/__tests__/asymmetricMatchers.test.ts | 6 ++---- packages/expect/src/asymmetricMatchers.ts | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/expect/src/__tests__/asymmetricMatchers.test.ts b/packages/expect/src/__tests__/asymmetricMatchers.test.ts index 66dfcc40add1..dae2bd6eeba1 100644 --- a/packages/expect/src/__tests__/asymmetricMatchers.test.ts +++ b/packages/expect/src/__tests__/asymmetricMatchers.test.ts @@ -227,7 +227,6 @@ test('ObjectContaining matches defined properties', () => { test('ObjectContaining matches prototype properties', () => { const prototypeObject = {foo: 'bar'}; let obj; - if (Object.create) { obj = Object.create(prototypeObject); } else { @@ -248,7 +247,7 @@ test('ObjectContaining throws for non-objects', () => { test('ObjectContaining does not match when non-objects are passed to the expect function as arguments', () => { for (const test of [ - objectContaining({}).asymmetricMatch("jest"), + objectContaining({}).asymmetricMatch('jest'), objectContaining({}).asymmetricMatch(10), objectContaining({}).asymmetricMatch(false), objectContaining({}).asymmetricMatch(undefined), @@ -256,8 +255,7 @@ test('ObjectContaining does not match when non-objects are passed to the expect ]) { jestExpect(test).toEqual(false); } - -}) +}); test('ObjectContaining does not mutate the sample', () => { const sample = {foo: {bar: {}}}; diff --git a/packages/expect/src/asymmetricMatchers.ts b/packages/expect/src/asymmetricMatchers.ts index cf1c53ec3928..a128863e0983 100644 --- a/packages/expect/src/asymmetricMatchers.ts +++ b/packages/expect/src/asymmetricMatchers.ts @@ -227,7 +227,6 @@ class ObjectContaining extends AsymmetricMatcher< } asymmetricMatch(other: any) { - // Ensures that the argument passed to the objectContaining method is an object if (typeof this.sample !== 'object') { throw new TypeError( @@ -243,7 +242,7 @@ class ObjectContaining extends AsymmetricMatcher< if (typeof other !== 'object' || Array.isArray(other)) { return false; } - + let result = true; const matcherContext = this.getMatcherContext();