title: How can I test that a component has an attribute?
body: <p>I use <code>testing-library</code></p>
  <p>I can't target the element if you have syntax solutions,
  I'm trying to retrieve the  tag and compare the <code>xlinkHref</code>.
  I can get the whole component and not having a class name or ID it bothers me
  // Type.test.jsx</p>
  <pre><code>import React from 'react';
  import { render, screen } from '@testing-library/react';
  import '@testing-library/jest-dom';
  
  import Type from '../index';
  
  describe('Type', () =&gt; {
  
    it('Watch Type', () =&gt; { 
      const {container} = render(&lt;Type type=&quot;Watch Type&quot; /&gt;);
  
      expect(container.firstElementChild.getAttribute('xlinkHref')).toHaveAttribute('xlinkHref', 'https://www.test.com/')
    });
  
  });
  </code></pre>
  <p>// Type.jsx</p>
  <pre><code>import React from 'react';
  
  const Type = (props) =&gt; {
    const type = props.type;
  
    if (type === 'Watch Type') {
      return (
        &lt;span className=&quot;platform-icon&quot;&gt;
          &lt;svg&gt;
            &lt;use xlinkHref=&quot;https://www.test.com/&quot; /&gt;
          &lt;/svg&gt;
        &lt;/span&gt;
      )
    }
  }
  
  export default App;
  </code></pre>