title: Sinon TypeError: Attempted to wrap undefined property getInternationals as function
body: <p>I'm using Cypress to write an integration test. Cypress uses Sinon for stubs and spies so cy.spy = sinon.spy.</p>
  
  <p>I'm trying to spy on a method from an imported module.</p>
  
  <p>I'm importing the module like so: <code>import * as internationals from "../../../src/api/Internationals";</code></p>
  
  <p>I then try to spy on a method inside <code>api/Internationals</code> like so: <code>cy.spy(internationals, "getInternationals");</code></p>
  
  <p>Resulting in this error:</p>
  
  <blockquote>
    <p>TypeError: Attempted to wrap undefined property getInternationals as function</p>
  </blockquote>
  
  <p>Contents of <code>api/Internationals.js</code>:</p>
  
  <pre><code>import ApiClient from "./ApiClient";
  
  export const getInternationals = ({ search, team, from, till, page = 1, per_page = 10, sort_column, sort_direction }) =&gt;
    ApiClient.get(`/players`, {
      params: {
        search: search ? (search === "#" ? "hek" : search) : null,
        team: team ? team : null,
        from: from ? from : null,
        till: till ? till : null,
        page: page,
        per_page: per_page,
        sort_column: sort_column ? sort_column : null,
        sort_direction: sort_direction ? sort_direction : null
      }
    });
  </code></pre>
  
  <p>Test contents:</p>
  
  <pre><code>/// &lt;reference types="Cypress" /&gt;
  
  import * as internationals from "../../../src/api/Internationals";
  
  describe("Can search for internationals", () =&gt; {
    it("Remembers filters after refreshing", () =&gt; {
      console.log(internationals);
      cy.spy(internationals, "getInternationals");
  
      expect(internationals.getInternationals).to.be.called;
    });
  });
  
  </code></pre>
  
  <p>Console logging <code>internationals</code> shows:
  <a href="https://i.stack.imgur.com/enDTY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/enDTY.png" alt="enter image description here"></a></p>
  
  <p>Am I missing something?</p>