title: How to mock the return value of messages.create() method from twilio-node using sinon js/loopback testlab?
body: <p>I'm trying to mock the return value of <strong>messages.create()</strong> method from <strong>twilio-node</strong> library.</p>
  <p>Since the create method resides inside the interface called <strong>messages</strong>, i can't directly mock the return value of create method.</p>
  <p><strong>My Unit test:</strong></p>
  <pre><code>import {
    createStubInstance,
    StubbedInstanceWithSinonAccessor,
  } from '@loopback/testlab';
  import sinon from 'sinon';
  import {Twilio} from '../../../../clients/whatsapp-sms-clients/twilio.whatsapp-sms-clients';
  import twilio from 'twilio';
  
  describe('Twilio client (UnitTest)', () =&gt; {
    let twilioMock: StubbedInstanceWithSinonAccessor&lt;twilio.Twilio&gt;;
    let logger: StubbedInstanceWithSinonAccessor&lt;LoggingService&gt;;
    let twilioClient: Twilio;
  
    beforeEach(() =&gt; {
      twilioMock = createStubInstance(twilio.Twilio);
      logger = createStubInstance(LoggingService);
      twilioClient = new Twilio(twilioMock, logger);
    });
  
    it('should create the message', async () =&gt; {
      twilioMock.stubs.messages.create.resolves({
        // mocked value
      });
    });
  });
  </code></pre>
  <p>Thanks in advance.</p>