title: sinon stub does not recognise a call to a stub
body: <p>This is the code to test:</p>
  
  <pre><code>    const AWS = require('aws-sdk');
  const { APPLICATIONS, NOTIFICATION_FREQUENCIES } = require('./config');
  
  exports.createHandler = ({ notificationService }) =&gt; async (event, context) =&gt; {
  
    try{
      Object.values(APPLICATIONS).forEach(async appId =&gt; {
  
        const notifications =  await notificationService
          .getNotificationsByApplication(appId);
  
  
  
        const dailyNotifications =notifications.filter(
          e =&gt;
            e.frequency === NOTIFICATION_FREQUENCIES.DAILY,
        );
  
        console.log('dailyNo', dailyNotifications);
  
        const dailyTemplate = notificationService.prepareDailyTemplate(
          dailyNotifications
        );
        console.log('dailyTemplate', dailyTemplate);
  
        notificationService.notifyToAdmin(dailyTemplate);
      });
    }
    catch(err) {
      console.log(err);
    }
  
  };
  </code></pre>
  
  <p>And this is my test using sinon:</p>
  
  <pre><code>const sinon = require('sinon');
  const { APPLICATIONS, NOTIFICATION_FREQUENCIES } = require('../lib/config');
  describe('Daily notifier tests', () =&gt; {
  
    it('should prepare daily template for each of the applications', () =&gt; {
  
      const notificationService = require('../lib/notificationService').createHandler({
        commands: {},
        simpleMailService: {},
      });
  
      const notifications = [
        {
          type: 'create_order',
          frequency: NOTIFICATION_FREQUENCIES.DAILY,
        },
        {
          type: 'create_order',
          frequency: NOTIFICATION_FREQUENCIES.DAILY,
        },
        {
          type: 'create_order',
          frequency: NOTIFICATION_FREQUENCIES.MONTHLY,
        },
      ];
      const template = 'some html template as string';
  
      sinon.stub(notificationService, 'getNotificationsByApplication').resolves(notifications);
      sinon.stub(notificationService, 'prepareDailyTemplate').returns(template);
      sinon.stub(notificationService, 'notifyToAdmin');
  
      const sut = require('../lib/dailyNotifier').createHandler({
        notificationService,
      });
  
      const event = {};
      const context = {};
  
  
      sut(event, context);
  
      const dailyNotifications = [
        {
          type: 'create_order',
          frequency: NOTIFICATION_FREQUENCIES.DAILY,
        },
        {
          type: 'create_order',
          frequency: NOTIFICATION_FREQUENCIES.DAILY,
        }
      ];
  
      sinon.assert.calledOnce(notificationService.prepareDailyTemplate);
      sinon.assert.calledWith(notificationService.notifyToAdmin, template);
  
  
    });
  
  });
  </code></pre>
  
  <p>According to sinon the method prepareDailyTemplate is not called at all (0 times), but when I execute the test I can even see the console.log 'dailyTemplate', which means that the method has been executed once.
  The error message:</p>
  
  <pre><code>AssertError: expected prepareDailyTemplate to be called once but was called 0 times
  </code></pre>
  
  <p>What I am doing wrong?</p>