sinon-mongoose is not working with sinon 9

Viewed 449

sinon-mongoose = 2.3.0 is not working with sinon 9

My code is as below

// test.js

const sinon = require('sinon');
require('sinon-mongoose');
const blog = require('../blog/blog.model');

it('GET Blogs /blogs/ls', (done) => {

    sinon
      .mock(blog)
      .expects('find')
      .chain('populate')
      .resolves([]);

    request(app)
      .get('/blogs/ls')
      .expect(200)
      .end((err, res) => {
        if (err) throw done(err);

        done();
      });
  });

The error is

TypeError: Cannot set property 'mock' of undefined

is there any other option or libs to mock model in mocha?

1 Answers
Related