For this method
content.js
const content = await Content.findOne({ _id: articleId })
I do the mock like:
content.test.js
Content.findOne = jest.fn(() => Promise.resolve({ some: 'content' }))
But how do I mock a find.toArray()
method which is used by the mongo native driver?
const posts = await Content.find({ category: 'foo' }).toArray()