title: how to unit test contents of a callback function with sinon.js
body: <p>how does one test a code inside a callback function using <code>sinon.js</code> framework for mocking?</p>
  
  <p><strong>JSFiddle: <a href="http://jsfiddle.net/ruslans/CE5e2/" rel="noreferrer">http://jsfiddle.net/ruslans/CE5e2/</a></strong></p>
  
  <pre><code>var service = function () {
      return {
          getData: function (callback) {
              return callback([1, 2, 3, 4, 5]);
          }
      }
  };
  
  var model = function (svc) {
      return {
          data: [],
          init: function () {
              var self = this;
              svc.getData(function (serviceData) {
                  self.data = serviceData; // *** test this line ***
              });
          }
      }
  };
  </code></pre>
  
  <p>I use mocha tests with chai but am familiar with qUnit, so any of these tests would be accepted.</p>