title: Mocking URLSeachParams
body: <p>We are using <code>jest</code> for mocking. <code>enzyme</code> for rendering in our application.</p>
  
  <p>Here I am trying to mock <code>URLSearchParams</code>'s <code>get</code> method. </p>
  
  <p>I tried to use </p>
  
  <pre><code>jest.spyOn(URLSearchParams, 'get'); 
  </code></pre>
  
  <p>But it's not working. </p>
  
  <p>My react class looks like bellow </p>
  
  <pre><code>export default class Concepts extends React.Component {
    static getDerivedStateFromProps(props) {
    const searchParams = new URLSearchParams(props.search);
    return {
       keyword: searchParams.get('q')
     };
  }
  </code></pre>
  
  <p>My test is looks like below</p>
  
  <pre><code>it('should be able to change the state', () =&gt; {
    jest.spyOn(URLSearchParams, 'get');
    const wrapper = mount(
          &lt;Concepts search="test" /&gt;
     );
  });
  </code></pre>
  
  <p>Is it correct way? are there any other ways to do it? Thanks in advance :) </p>