title: Node js mail jet method chaining stub
body: <p>Here, I want to assert that callback function is called or not. So how can I do it using sinon js. Please suggest.</p>
  
  <pre><code>var send = function (templateId, callback) {
  
      const request = mailjet
          .post("send")
          .request(params)
      request
          .then((result) =&gt; {
              if (typeof callback === 'function') {
                  callback(null, result.body);
              }
  
          })
          .catch((err) =&gt; {
              if (typeof callback === 'function') {
                  callback(err, null);
              }
          })
      } else {
          callback(err, null);
      }
  };
  </code></pre>
  
  <p>I have tried as following:</p>
  
  <pre><code>var mailjetClient = require('../../node_modules/node-mailjet/mailjet-client');
  
  sinon.stub(mailjet, 'post').withArgs('send').returns(mailjetClient);
  sinon.stub(mailjetClient, 'request').returns(Promise);
  </code></pre>
  
  <p>I am getting following error:</p>
  
  <pre><code>TypeError: Attempted to wrap undefined property request as function
  </code></pre>