Socket
Socket
Sign inDemoInstall

@gocardless/stubby

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gocardless/stubby - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

7

dist/modules/stubby-chaos-monkey-bundle.js

@@ -20,5 +20,2 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.StubbyChaosMonkey = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

this.register = function(handler) {
// Request is empty on route setup.
handler.on('setup', this.onRequestSetup, this);
// Called before a request and response are matched

@@ -40,6 +37,2 @@ handler.on('routesetup', this.onRouteSetup, this);

this.onRequestSetup = function(request, stub) {
// console.log('[requestsetup] ', request, stub);
};
this.onRequestExecute = function(request, stub) {

@@ -46,0 +39,0 @@ if (stub.internal.options.chaos) {

2

dist/modules/stubby-chaos-monkey-bundle.min.js

@@ -1,1 +0,1 @@

(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.StubbyChaosMonkey=f()}})(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";var StubbyChaosMonkey=function(){var getRandomArbitrary=function(min,max){return Math.random()*(max-min)+min};var getRandomHTTPStatus=function(){return getRandomArbitrary(100,600)};this.register=function(handler){handler.on("setup",this.onRequestSetup,this);handler.on("routesetup",this.onRouteSetup,this);handler.on("request",this.onRequestExecute,this)};this.onRouteSetup=function(request,stub){if(!stub.internal.options.chaos){return}if(stub.response.status!==43){throw new Error("Response status needs to be `43` for a valid chaos response")}};this.onRequestSetup=function(request,stub){};this.onRequestExecute=function(request,stub){if(stub.internal.options.chaos){stub.response.status=getRandomHTTPStatus()}}};if(typeof module==="undefined"){window.StubbyChaosMonkey=StubbyChaosMonkey}else{module.exports=StubbyChaosMonkey}},{}]},{},[1])(1)});
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.StubbyChaosMonkey=f()}})(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";var StubbyChaosMonkey=function(){var getRandomArbitrary=function(min,max){return Math.random()*(max-min)+min};var getRandomHTTPStatus=function(){return getRandomArbitrary(100,600)};this.register=function(handler){handler.on("routesetup",this.onRouteSetup,this);handler.on("request",this.onRequestExecute,this)};this.onRouteSetup=function(request,stub){if(!stub.internal.options.chaos){return}if(stub.response.status!==43){throw new Error("Response status needs to be `43` for a valid chaos response")}};this.onRequestExecute=function(request,stub){if(stub.internal.options.chaos){stub.response.status=getRandomHTTPStatus()}}};if(typeof module==="undefined"){window.StubbyChaosMonkey=StubbyChaosMonkey}else{module.exports=StubbyChaosMonkey}},{}]},{},[1])(1)});

@@ -0,1 +1,2 @@

/* global Stubby */
'use strict';

@@ -17,3 +18,3 @@

stubby.stub({
url: '/widget?id=2', method: 'POST'
url: '/widget?id=2', method: 'POST'
}).respondWith(200, {message: 'Shiny :)'});

@@ -20,0 +21,0 @@

'use strict';
var Stubby = require('./stubby')({
lodash: require('lodash'),
pretender: require('pretender'),
querystring: require('query-string')
lodash: require('lodash'),
pretender: require('pretender'),
querystring: require('query-string')
});

@@ -8,0 +8,0 @@

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

this.register = function(handler) {
// Request is empty on route setup.
handler.on('setup', this.onRequestSetup, this);
// Called before a request and response are matched

@@ -39,6 +36,2 @@ handler.on('routesetup', this.onRouteSetup, this);

this.onRequestSetup = function(request, stub) {
// console.log('[requestsetup] ', request, stub);
};
this.onRequestExecute = function(request, stub) {

@@ -45,0 +38,0 @@ if (stub.internal.options.chaos) {

@@ -81,5 +81,3 @@ 'use strict';

return _.find(this.hyperschemaUrls[routeRef], function(schema) {
if (schema.method === stub.request.method) {
return true;
}
return schema.method === stub.request.method;
});

@@ -90,3 +88,3 @@ };

var keyTraverse = _.find(Object.keys(request.data), function(key) {
return (stub.url.indexOf(key) !== -1);
return stub.url.indexOf(key) !== -1;
});

@@ -93,0 +91,0 @@ var requestData = request.data;

{
"name": "@gocardless/stubby",
"description": "AJAX Testing Stub Library",
"version": "0.0.9",
"version": "0.0.10",
"main": "index.js",

@@ -49,3 +49,3 @@ "directories": {

"dependencies": {
"lodash": "^3.10.1",
"lodash": "^4.17.11",
"pretender": "^0.10.1",

@@ -57,7 +57,7 @@ "query-string": "^2.4.2",

"devDependencies": {
"babel-eslint": "^4.1.6",
"babel-eslint": "^10.0.1",
"browserify": "^10.1.3",
"eslint": "^1.10.3",
"eslint": "^5.8.0",
"fake-xml-http-request": "^2.0.0",
"jest": "^23.4.0",
"jest": "^23.6.0",
"uglifyjs": "^2.4.10",

@@ -64,0 +64,0 @@ "url-parse": "^1.4.1"

@@ -6,2 +6,5 @@ # This library is legacy and will be modified to help us move away from it, and will not be maintained with the plan to deprecate this library later this year (2018).

## Continuous Integration
Currently this project is tested in Circle CI v1 which is past it's sunset and could be switched off at any time. There are currently no plans to migrate this project as no major changes are being made, and no plans to support this longer term. If you plan on making major changes to this project we recommend you [migrate it to use Circle CI V2](https://circleci.com/docs/2.0/migrating-from-1-2/) first.
### AJAX Testing Stub Library

@@ -8,0 +11,0 @@

@@ -29,6 +29,6 @@ const stubbyFactory = require('./stubby');

}
}
};
}
return originalDocumentCreateElement(tagName);
})
});

@@ -35,0 +35,0 @@ const Pretender = require('pretender');

@@ -120,5 +120,5 @@ describe('create stubby', () => {

{ a: 1 },
{
headers: { foo: 'bar' }
}
{
headers: { foo: 'bar' }
}
);

@@ -125,0 +125,0 @@

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

Stubby.prototype.on = function(name, handler, thisArg) {
if (this.events.whitelist && !_.contains(this.events.whitelist, name)) {
if (this.events.whitelist && !_.includes(this.events.whitelist, name)) {
throw new Error('"' + name + '" is not a valid event handler');

@@ -72,3 +72,3 @@ }

});
}, this);
}.bind(this));
};

@@ -75,0 +75,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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