New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mockingoose

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mockingoose - npm Package Compare versions

Comparing version 2.13.0 to 2.13.1

18

package.json
{
"name": "mockingoose",
"version": "2.13.0",
"version": "2.13.1",
"description": "A Jest package for mocking mongoose models",

@@ -30,12 +30,12 @@ "main": "./lib",

"devDependencies": {
"@types/jest": "^24.0.11",
"@types/mongoose": "^5.3.23",
"jest": "^24.5.0",
"prettier": "^1.16.4",
"ts-jest": "^24.0.0",
"ts-node": "^8.0.3",
"tslint": "^5.14.0",
"@types/jest": "^24.0.13",
"@types/mongoose": "^5.5.5",
"jest": "^24.8.0",
"prettier": "^1.18.2",
"ts-jest": "^24.0.2",
"ts-node": "^8.2.0",
"tslint": "^5.17.0",
"tslint-config-prettier": "^1.18.0",
"tslint-plugin-prettier": "^2.0.1",
"typescript": "^3.3.4000"
"typescript": "^3.5.1"
},

@@ -42,0 +42,0 @@ "peerDependencies": {

@@ -195,2 +195,26 @@ # Mockingoose [![CircleCI](https://circleci.com/gh/alonronin/mockingoose/tree/master.svg?style=svg)](https://circleci.com/gh/alonronin/mockingoose/tree/master)

- you can mock `.populate` in your mocked result just be sure to change
the `Schema`'s path to appropriate type (eg: `Object` | `Mixed`):
```js
User.schema.path('foreignKey', Object);
const doc = {
email: 'test@mail.com',
foreignKey: {
_id: '5ca4af76384306089c1c30ba',
name: 'test',
value: 'test',
},
name: 'Name',
saveCount: 1,
};
mockingoose(User).toReturn(doc);
const result = await User.find();
expect(result).toMatchObject(doc);
```
- no connection is made to the database (mongoose.connect is jest.fn())

@@ -204,7 +228,7 @@

- `mockingoose.ModelName` is deprecated, `mockingoose(Model)` is the now the recommended usage, with `Model` being a Mongoose model class.
- `mockingoose.ModelName` is deprecated, `mockingoose(Model)` is the now the recommended usage, with `Model` being a Mongoose model class.
Alternatively, you may pass a string with the model name.
- `mockingoose(Model).toReturn((query) => value)` can now take also take a function as a parameter.
- `mockingoose(Model).toReturn((query) => value)` can now take also take a function as a parameter.

@@ -211,0 +235,0 @@ The function is called with either a [Query](https://mongoosejs.com/docs/api.html#Query) or [Aggregate](https://mongoosejs.com/docs/api.html#Aggregate) object from Mongoose, depending on the request. This allows tests to ensure that proper queries are sent out, and helps with regression testing.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc