Huge News!Announcing our $40M Series B led by Abstract Ventures.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.1.0 to 2.1.1

28

___tests___/index.test.js

@@ -125,2 +125,30 @@ import mockingoose from '../src/index';

})
});
it('should return object with .toJSON()', () => {
mockingoose.User
.toReturn({ name: 'name' })
.toReturn({ name: 'a name too' }, 'findOne')
.toReturn({ name: 'another name' }, 'save');
const mocksString = '{"User":{"find":{"name":"name"},"findOne":{"name":"a name too"},"save":{"name":"another name"}}}';
const mockString = '{"find":{"name":"name"},"findOne":{"name":"a name too"},"save":{"name":"another name"}}';
const mocksObject = {
User: {
find: {
name: 'name'
},
findOne: {
name: 'a name too'
},
save: {
name: 'another name'
}
}
};
expect(JSON.stringify(mockingoose)).toBe(mocksString);
expect(JSON.stringify(mockingoose.User)).toBe(mockString);
expect(mockingoose.toJSON()).toEqual(mocksObject);
})

@@ -127,0 +155,0 @@ });

@@ -106,2 +106,5 @@ 'use strict';

this.__mocks = {};
},
toJSON: function toJSON() {
return this.__mocks;
}

@@ -126,2 +129,5 @@ };

return this;
},
toJSON: function toJSON() {
return target.__mocks[prop] || {};
}

@@ -128,0 +134,0 @@ };

2

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

@@ -5,0 +5,0 @@ "main": "./lib",

@@ -102,3 +102,3 @@ # Mockingoose

### Operation available:
### Operations available:

@@ -105,0 +105,0 @@ - [x] `find` - for find query

@@ -95,3 +95,4 @@ import mongoose from 'mongoose';

__mocks: {},
resetAll() { this.__mocks = {} }
resetAll() { this.__mocks = {} },
toJSON() { return this.__mocks }
};

@@ -116,2 +117,6 @@

return this;
},
toJSON() {
return target.__mocks[prop] || {};
}

@@ -118,0 +123,0 @@ };

Sorry, the diff of this file is not supported yet

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