title: Error: <toHaveBeenCalled> : Expected a spy, but got Function
body: <p>Here is the test code</p>
  
  <pre><code>var list = new List([1, 2, 3, 4]);
  var list2 = new List([5, 1]);
  
  beforeAll(function () {
    spyOn(list.values, 'map').and.callThrough();
  
    list.map(plusOne);
  });
  
  it('Array.prototype.map()', function () {
    expect(list.values.map).not.toHaveBeenCalled();
  });
  
  This results in the following error 1) List must not call native Array function Array.prototype.map()   Message:
      Error: &lt;toHaveBeenCalled&gt; : Expected a spy, but got Function.
      Usage: expect(&lt;spyObj&gt;).toHaveBeenCalled()
  
    class List {
      constructor(clist = []) {
          this.values = clist;
      }
      map(f) {
          var temp = [];
          this.values.forEach((item, index) =&gt; {
                     temp.push(f(item));
                  });
          this.values = temp;
          return this;
      }
  }
  module.exports = { List };
  </code></pre>
  
  <p>I do not think this is a unit test fail as such because I get the same message whether I call not.tohaveBeenCalled() or toHaveBeenCalled().</p>
  
  <p>I am using node 8.9.4 and jasmine 2.8.0.</p>
  
  <p>I believe the syntax is correct because when I run others code against these tests they pass. But my code causes this error.</p>
  
  <p>My question is what does the above error mean?
  Regards,</p>