title: Jasmine SpyOn on function calls
body: <p>Hello I got a question regarding mocking JS code with Jasmine.</p>
  
  <p>Imagine having the following situation:</p>
  
  <pre><code>function Test(){
      var a = 5;
      var b = 3;
      Test2(a,b);
  }
  function Test2(a,b){
      var result = a + b;
      console.log("result of function Test2: ", result);
  }
  </code></pre>
  
  <p>I want to mock my Test2 function call with Jasmine. I tried the following thing:</p>
  
  <pre><code>describe("1# Test Mocking", function () {                                   
      it("test: Mocking Example", function () {                                                           
          var myMock = new Test();                        
          spyOn(myMock, "Test2").and.returnValue(10,10);              
          expect(Test2.result).toEqual(20);       
      });         
  });   
  </code></pre>
  
  <p>But Jasmine keeps saying: <code>Error: Test2() method does not exist</code></p>
  
  <p>Does anyone knows why this is and how I could solve this?</p>