title: React Testing Library : check if multiple elements have href
body: <p>I'd like to check if all links in a <code>&lt;ul&gt;</code> have a <code>href</code> attribute.</p>
  <p>Component (uses Gatsby's <code>&lt;Link&gt;</code>) :</p>
  <pre><code>const DropdownMenu = ({ open }) =&gt; {
    return (
      &lt;ul className=&quot;dropdown-menu&quot;&gt;
        {open &amp;&amp; (
          &lt;&gt;
            &lt;li&gt;
              &lt;Link to=&quot;/link1/&quot;&gt;Link 1&lt;/Link&gt;
            &lt;/li&gt;
            &lt;li&gt;
              &lt;Link to=&quot;/link2/&quot;&gt;Link 2&lt;/Link&gt;
            &lt;/li&gt;
            &lt;li&gt;
              &lt;Link to=&quot;/link3/&quot;&gt;Link 3&lt;/Link&gt;
            &lt;/li&gt;
          &lt;/&gt;
        )}
      &lt;/ul&gt;
    )
  }
  </code></pre>
  <p>Rendered HTML :</p>
  <pre><code>...
          &lt;ul
            class=&quot;dropdown-menu&quot;
          &gt;
            &lt;li&gt;
              &lt;a
                href=&quot;/link1/&quot;
              &gt;
                Link 1
              &lt;/a&gt;
            &lt;/li&gt;
            &lt;li&gt;
              &lt;a
                href=&quot;/link2/&quot;
              &gt;
                Link 2
              &lt;/a&gt;
            &lt;/li&gt;
            &lt;li&gt;
              &lt;a
                href=&quot;/link3/&quot;
              &gt;
                Link 3
              &lt;/a&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
  ...
  </code></pre>
  <p>Test :</p>
  <pre><code>  test('links have href', () =&gt; {
      render(&lt;DropdownMenu open={true}&gt;&lt;/DropdownMenu&gt;)
      const listLinks = screen.getAllByRole('link')
      expect(listLinks).toHaveAttribute('href')
    })
  </code></pre>
  <p>Output :</p>
  <pre><code>received value must be an HTMLElement or an SVGElement.
  Received has type:  array
  Received has value: [&lt;a href=&quot;/link1/&quot;&gt;Link 1&lt;/a&gt;, &lt;a href=&quot;/link2/&quot;&gt;Link 2&lt;/a&gt; ...]
  </code></pre>
  <p>Is there a way (like a <code>map</code> or something) to check if all elements have correct <code>href</code> ?</p>
  <p>I might be using the wrong approch here.</p>