title: Jest to test HTML String
body: <p>How do I test a HTML string using Jest?</p>
  
  <p>Right now, I am doing it using regular string comparison like below. When I run this test case, it works fine.</p>
  
  <pre><code>it('should compile partial as per the context', () =&gt; {
    const receivedOutput = someFunctionReturningHTMLString();
    //*PS: someFunctionReturningHTMLString() is function which returns a html string;*
    //In above call, lets assume it returns `&lt;a href="/" class="some_class1 some_class2" &gt;`
  
    const expectedResult = `&lt;a href="/" class="some_class1 some_class2" &gt;`;
    expect(receivedOutput .trim()).toEqual(expectedResult.trim())
  });
  </code></pre>
  
  <p>However, I don't find this approach of testing pure string values as a good approach.</p>
  
  <p>Can somebody help me with a better way where I can actually test the content of the HTML string? Like testing whether the  tag in the string has a particular class? Something like what we can achieve with Enzyme for React components.</p>