Skip to content

Commit

Permalink
Test ObjectContaining with cross-realm inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
ninevra committed Oct 27, 2020
1 parent c523b65 commit 0553005
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/expect/src/__tests__/asymmetricMatchers.test.ts
Expand Up @@ -185,6 +185,19 @@ test('ObjectContaining matches', () => {
});
});

test('ObjectContaining recurses into other-realm objects', () => {
const other_realm = new TextEncoder().encodeInto(
'hello world',
new Uint8Array(100),
); // returns {read: 11, written: 11} from Node
jestExpect({foo: other_realm}).toEqual({foo: {read: 11, written: 11}});
jestExpect(
objectContaining({foo: other_realm}).asymmetricMatch({
foo: {read: 11, written: 11, zed: 11},
}),
).toEqual(true);
});

test('ObjectContaining does not match', () => {
[
objectContaining({foo: 'foo'}).asymmetricMatch({bar: 'bar'}),
Expand Down

0 comments on commit 0553005

Please sign in to comment.