title: How to access prop value in react-testing-library
body: <p>I have been writing a test for my alert.js. I need to access prop value to test its severity. I tried lots of things. But failed every time.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import React from 'react';
  import PropTypes from 'prop-types';
  import { Snackbar } from '@material-ui/core';
  import { Alert as MuiAlert } from '@material-ui/lab';
  
  const Alert = (props) =&gt; {
      return (
          &lt;Snackbar
              open={props.open}
              autoHideDuration={3000}
              onClose={props.onClose}
              data-testid='component-alert'
          &gt;
              &lt;MuiAlert
                  onClose={props.onClose}
                  severity={props.severity}
                  data-testid='alert-message'
              &gt;
                  {props.message}
              &lt;/MuiAlert&gt;
          &lt;/Snackbar&gt;
      );
  };
  
  Alert.propTypes = {
      message: PropTypes.string.isRequired,
      severity: PropTypes.oneOf(['error', 'warning', 'info', 'success'])
          .isRequired,
      open: PropTypes.bool.isRequired,
      onClose: PropTypes.func.isRequired,
  };
  
  export default Alert;</code></pre>
  </div>
  </div>
  </p>
  <p>import { render, cleanup } from '@testing-library/react';
  import Alert from '../Alert';</p>
  <p>const mockFunc = jest.fn();
  const defaultProps = {
  message: 'abc',
  severity: 'error',
  open: true,
  onClose: mockFunc,
  };</p>
  <pre><code>test('render correct severity', () =&gt; {
      render(&lt;Alert {...defaultProps}/&gt;)
      //How to access severity prop value here
  });
  </code></pre>
  <p>});</p>
  <pre><code></code></pre>