title: How to test default exported javascript module in Jest?
body: <p>I have a <code>module.js</code> file with content like this</p>
  
  <pre><code>export default {
      foo(),
      bar()
  }
  </code></pre>
  
  <p>I have tried doing this on my test file</p>
  
  <pre><code>jest.mock('/module/path', () =&gt; {
    foo: jest.fn().mockReturnValue(true)
  })
  
  import Module from './module/path'
  </code></pre>
  
  <p>and this is the test that I'm trying to do</p>
  
  <pre><code>  test('test the module', () =&gt; {
      let fooSpy= jest.spyOn(Module, 'foo')
  
      vm.methodThatUseFoo()
  
      expect(fooSpy).toBeCalled()
    })
  </code></pre>
  
  <p>and this is the error that I encountered</p>
  
  <p><code>Cannot spyOn on a primitive value; undefined given</code></p>