1. // test() is part of Jest's serializer API
    
  2. export function test(maybeInspectedElement) {
    
  3.   if (
    
  4.     maybeInspectedElement === null ||
    
  5.     typeof maybeInspectedElement !== 'object'
    
  6.   ) {
    
  7.     return false;
    
  8.   }
    
  9. 
    
  10.   const hasOwnProperty = Object.prototype.hasOwnProperty.bind(
    
  11.     maybeInspectedElement,
    
  12.   );
    
  13. 
    
  14.   return (
    
  15.     hasOwnProperty('canEditFunctionProps') &&
    
  16.     hasOwnProperty('canEditHooks') &&
    
  17.     hasOwnProperty('canToggleSuspense') &&
    
  18.     hasOwnProperty('canToggleError') &&
    
  19.     hasOwnProperty('canViewSource')
    
  20.   );
    
  21. }
    
  22. 
    
  23. // print() is part of Jest's serializer API
    
  24. export function print(inspectedElement, serialize, indent) {
    
  25.   // Don't stringify this object; that would break nested serializers.
    
  26.   return serialize({
    
  27.     context: inspectedElement.context,
    
  28.     events: inspectedElement.events,
    
  29.     hooks: inspectedElement.hooks,
    
  30.     id: inspectedElement.id,
    
  31.     owners: inspectedElement.owners,
    
  32.     props: inspectedElement.props,
    
  33.     rootType: inspectedElement.rootType,
    
  34.     state: inspectedElement.state,
    
  35.   });
    
  36. }