Skip to content

Commit

Permalink
chore: fix lint issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammednumaan committed Jan 17, 2025
1 parent d250a5e commit 569ba43
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 2 additions & 4 deletions packages/expect/src/__tests__/asymmetricMatchers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -248,16 +247,15 @@ 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),
objectContaining({}).asymmetricMatch([]),
]) {
jestExpect(test).toEqual(false);
}

})
});

test('ObjectContaining does not mutate the sample', () => {
const sample = {foo: {bar: {}}};
Expand Down
3 changes: 1 addition & 2 deletions packages/expect/src/asymmetricMatchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -243,7 +242,7 @@ class ObjectContaining extends AsymmetricMatcher<
if (typeof other !== 'object' || Array.isArray(other)) {
return false;
}

let result = true;

const matcherContext = this.getMatcherContext();
Expand Down

0 comments on commit 569ba43

Please sign in to comment.