title: how to write unit test case for both normal callback and q and promise callback?
body: <p>I have one function in which i have written code to handle callback like this </p>
  
  <pre><code>exports.CallbackExample=function(req,res)
  {
     return callfunction().then(function(data)
    {
        saveData(data).save(function(err,responseData)
       {
            res.send(responseData);
  
       })
  
    });
  
  }
  </code></pre>
  
  <p>I want to write unit test case for the above code . so i have written like this </p>
  
  <pre><code>var res={};
  var spy=res.send=sinon.spy();
  CallbackExample(req,res).then(function()
  {
  
     expect(spy.calledOnce).to.equal('true');
  
  });
  </code></pre>
  
  <p>but this is not working. I think the reason is that function has two different callback like first one callback (Q and promises ) and second one is normal callback ....I think may be because of that reason this is not working. I am not able to move forward because of this obstacle . so how to write unit test case for that function with out making any changes in that function ?....is that possible ? ..I hope any one of you will help me. Thanks in advance I am waiting for yours solution ..</p>