I am trying to mock my mongoose schemas.with this code :
// report.schema.js
import mongoose, { Schema } from 'mongoose';
const reportSchema = new Schema(
{
data:{
type: string
},
},
{ timestamps: true }
);
export default mongoose.model('Report', reportSchema);
and inside my test:
import mockingoose from "mockingoose";
import Report from "../mongodb/models/report";
mockingoose(Report).toReturn({ data: "some_foo" }, "findOne");
and the error is:
● Test suite failed to run
TypeError: (0 , _mockingoose.default) is not a function
1 | import mockingoose from "mockingoose";
2 | import Report from "../mongodb/models/report";
> 3 | mockingoose(Report).toReturn({ data: "some_foo" }, "findOne");
