mockingoose
Advanced tools
Comparing version 2.9.0 to 2.9.1
@@ -107,12 +107,16 @@ 'use strict'; | ||
_mongoose2.default.Model.prototype.save = jest.fn().mockImplementation(function (options, cb) { | ||
var op = 'save'; | ||
var modelName = this.constructor.modelName; | ||
var instance = ['remove', 'save']; | ||
instance.forEach(function (methodName) { | ||
_mongoose2.default.Model.prototype[methodName] = jest.fn().mockImplementation(function (options, cb) { | ||
var op = methodName; | ||
var modelName = this.constructor.modelName; | ||
if (typeof options === 'function') cb = options; | ||
Object.assign(this, { op: op, model: { modelName: modelName } }); | ||
if (typeof options === 'function') cb = options; | ||
return mockedReturn.call(this, cb); | ||
Object.assign(this, { op: op, model: { modelName: modelName } }); | ||
return mockedReturn.call(this, cb); | ||
}); | ||
}); | ||
@@ -119,0 +123,0 @@ |
{ | ||
"name": "mockingoose", | ||
"version": "2.9.0", | ||
"version": "2.9.1", | ||
"description": "A Jest package for mocking mongoose models", | ||
@@ -5,0 +5,0 @@ "main": "./lib", |
@@ -157,4 +157,5 @@ # Mockingoose | ||
- [x] Return `Jest.fn` for `Model.save` mock; | ||
- [x] Return `Jest.fn` for `Model.save` mock | ||
- [ ] Support `Model.aggregate` | ||
[logo]: http://animals.sandiegozoo.org/sites/default/files/2016-12/DwarfMongoose_ZN.jpg |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19268
123
161