title: How to test DOM manipulation in JEST
body: <p>I'm trying to test a ES6 function which updates the dom element whenever it is being executed. Currently I'm getting empty nodelist since the HTML page is not loaded. What is approach to test this purely with JEST?</p>
  
  <pre><code>jest.dontMock('../scripts/taskModel');
  import Request from '../__mocks__/request';
  import Task from '../scripts/taskModel';
  
  describe('taskModel', () =&gt; {
      it('Should initialize with no friends items', function() {
          expect(document.querySelectorAll('.panel-block').length).toBe(1); // THIS IS ALWAYS RETURNS EMPTY NODELIST
          var task = new Task();
          task.index();
          expect(document.querySelectorAll('.panel-block').length).toBeGreaterThanOrEqual(6); // THIS IS ALWAYS RETURNS EMPTY NODELIST
      });
  });
  </code></pre>