Skip to content

Commit

Permalink
Use toMatchInlineSnapshot for dehydrated values (#20618)
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Apr 26, 2021
1 parent 4874042 commit 84b9162
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 84b9162

Please sign in to comment.