2021-03-17 02:54:39 +13:00
|
|
|
const mongodb = {}
|
|
|
|
|
2021-05-03 19:31:09 +12:00
|
|
|
mongodb.MongoClient = function () {
|
2021-03-17 02:54:39 +13:00
|
|
|
this.connect = jest.fn()
|
|
|
|
this.close = jest.fn()
|
|
|
|
this.insertOne = jest.fn()
|
|
|
|
this.find = jest.fn(() => ({ toArray: () => [] }))
|
|
|
|
|
|
|
|
this.collection = jest.fn(() => ({
|
|
|
|
insertOne: this.insertOne,
|
|
|
|
find: this.find,
|
|
|
|
}))
|
|
|
|
|
|
|
|
this.db = () => ({
|
|
|
|
collection: this.collection,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = mongodb
|