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

stub-promise-function

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stub-promise-function - npm Package Compare versions

Comparing version 1.0.3 to 2.0.1

9

index.js
'use strict';
var Q = require('q');
var sinon = require('sinon');

@@ -7,6 +8,8 @@ module.exports = function() {

var func = function() {
return deferred.promise;
};
// var func = function() {
// return deferred.promise;
// };
var func = sinon.stub().returns(deferred.promise);
func.resolve = function(value) {

@@ -13,0 +16,0 @@ deferred.resolve(value);

{
"name": "stub-promise-function",
"version": "1.0.3",
"version": "2.0.1",
"description": "A test utility that lets you stub and control promises for testing purposes",

@@ -20,3 +20,4 @@ "repository": "https://github.com/jonbern/stub-promise-function.git",

"dependencies": {
"q": "^1.4.1"
"q": "^1.4.1",
"sinon": "^1.17.3"
},

@@ -23,0 +24,0 @@ "devDependencies": {

@@ -59,8 +59,4 @@ # stub-promise-function

```javascript
var expect = require('expectations');
var sinon = require('sinon');
var stubPromiseFunction = require('stub-promise-function');
describe('#stubPromiseFunction()', function() {
describe('stubPromiseFunction', function() {
var http;

@@ -71,3 +67,3 @@ var promise;

http = {
get: stubPromiseFunction()
get: stubPromise()
};

@@ -130,8 +126,4 @@ });

describe('test spy example', function() {
describe('spy functionality (using sinon.spy internally)', function() {
beforeEach(function() {
sinon.spy(http, 'get');
});
beforeEach(function simulateApi() {

@@ -148,3 +140,3 @@ http.get('http://whatever');

describe('multiple invocation by re-instantiation example', function() {
describe('multiple invocation by re-instantiation', function() {

@@ -156,3 +148,3 @@ var http;

http = {
get: stubPromiseFunction()
get: stubPromise()
};

@@ -173,3 +165,3 @@

it('can be reinstantiated and then resolved', function() {
http.get = stubPromiseFunction();
http.get = stubPromise();

@@ -176,0 +168,0 @@ promise = http.get('http://another');

@@ -6,3 +6,3 @@ 'use strict';

describe('stubPromise', function() {
describe('#stubPromiseFunction()', function() {

@@ -72,8 +72,4 @@ var http;

describe('test spy example', function() {
describe('spy functionality (using sinon.spy internally)', function() {
beforeEach(function() {
sinon.spy(http, 'get');
});
beforeEach(function simulateApi() {

@@ -90,3 +86,3 @@ http.get('http://whatever');

describe('multiple invocation by re-instantiation example', function() {
describe('multiple invocation by re-instantiation', function() {

@@ -93,0 +89,0 @@ var http;

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