title: how to stub a function that returns an object in QUnit?
body: <p>I have the following lines in my SAPUI5 app </p>
  
  <pre><code>var dateVal = controls.awardDate.getDateValue();
  var month = dateVal.getMonth();
  </code></pre>
  
  <p>awardDate is a datepicker the user enters a date on and returns a javascript date object. This is a snippet of my qunit to test this element.</p>
  
  <pre><code>awardDate: {
    getValue: getInvalidValue,
    getValueState: getValueStateWarning,
    setValue: setValue,
    getDatevalue: getDateValue
   }
  </code></pre>
  
  <p>In my qunit I get an error saying that the object doesn't support property or method 'getDateValue'. I'm not sure how I'm supposed to stub this function when it returns an object. Other tests I have do it this way</p>
  
  <pre><code>var getValue = sinon.stub().returns('');
  </code></pre>
  
  <p>where I get an empty string.
  so my attempt at to do it with the datepicker is</p>
  
  <pre><code>var getDateValue = sinon.stub().returns(new Date());
  </code></pre>
  
  <p>but this doesn't work. I still get the same error. Has anyone done this before?</p>
  
  <p><strong>edit/update:</strong> I was able to fix part of the problem by doing the following</p>
  
  <pre><code>var getValueDate = sinon.stub().returns(Object, function(){ });
  </code></pre>
  
  <p>Now the problem I have is the same error but for getMonth() which returns a string. All other variables are global but dateVal is created on the spot when the user updates the datepicker. Any ideas on how to proceed on this one?</p>