Skip to content

Commit

Permalink
Use toMatchInlineSnapshot for dehydrated values (facebook#20618)
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon authored and koto committed Jun 15, 2021
1 parent cde08b4 commit 959dae0
Show file tree
Hide file tree
Showing 7 changed files with 297 additions and 334 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@
// test() is part of Jest's serializer API
export function test(maybeDehydratedValue) {
const {meta} = require('react-devtools-shared/src/hydration');

const hasOwnProperty = Object.prototype.hasOwnProperty.bind(
maybeDehydratedValue,
);
return (
maybeDehydratedValue !== null &&
typeof maybeDehydratedValue === 'object' &&
maybeDehydratedValue.hasOwnProperty(meta.inspectable) &&
hasOwnProperty(meta.inspectable) &&
maybeDehydratedValue[meta.inspected] !== true
);
}
Expand Down

0 comments on commit 959dae0

Please sign in to comment.