Socket
Socket
Sign inDemoInstall

nock

Package Overview
Dependencies
Maintainers
1
Versions
430
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nock - npm Package Compare versions

Comparing version 0.3.1 to 0.4.0

4

lib/intercept.js

@@ -30,3 +30,3 @@ var path = require('path')

}
if (! interceptors) { delete allInterceptors[hostKey]; }
//if (! interceptors) { delete allInterceptors[hostKey]; }
}

@@ -330,3 +330,3 @@

if (interceptors && interceptors.length > 0) {
if (interceptors) {
return processRequest(interceptors, options, callback);

@@ -333,0 +333,0 @@ } else {

@@ -124,4 +124,8 @@ var path = require('path')

function isDone() {
return (Object.keys(interceptors).length === 0, "Mocks not yet satisfied:\n" + pendingMocks().join("\n"));
}
function done() {
assert.ok(Object.keys(interceptors).length === 0, "Mocks not yet satisfied:\n" + pendingMocks().join("\n"));
assert.ok(isDone);
}

@@ -180,2 +184,3 @@

, done: done
, isDone: isDone
, filteringPath: filteringPath

@@ -182,0 +187,0 @@ , filteringRequestBody: filteringRequestBody

{ "name" : "nock"
, "description" : "HTTP Server mocking for Node.js"
, "tags" : ["Mock", "HTTP", "testing", "isolation"]
, "version" : "0.3.1"
, "version" : "0.4.0"
, "author" : "Pedro Teixeira <pedro.teixeira@gmail.com>"

@@ -15,3 +15,3 @@ , "contributors" :

, "bugs" :
{ "web" : "http://github.com/pgte/nock/issues" }
{ "url" : "http://github.com/pgte/nock/issues" }
, "engines" : ["node >= 0.4.10"]

@@ -18,0 +18,0 @@ , "main" : "./index"

@@ -100,3 +100,3 @@ # Nock

var scope = nock('http://api.myservice.com')
.filterPath(/password=[^&]*/g, 'password=XXX')
.filteringPath(/password=[^&]*/g, 'password=XXX')
.get('/users/1?password=XXX')

@@ -108,3 +108,3 @@ .reply(200, 'user');

var scope = nock('http://api.myservice.com')
.filterPath(function(path) {
.filteringPath(function(path) {
return '/ABC';

@@ -124,3 +124,3 @@ })

var scope = nock('http://api.myservice.com')
.filterRequestBody(/password=[^&]*/g, 'password=XXX')
.filteringRequestBody(/password=[^&]*/g, 'password=XXX')
.post('/users/1', 'data=ABC&password=XXX')

@@ -132,3 +132,3 @@ .reply(201, 'OK');

var scope = nock('http://api.myservice.com')
.filterRequestBody(function(path) {
.filteringRequestBody(function(path) {
return 'ABC';

@@ -157,2 +157,7 @@ })

## .isDone()
You can also call `isDone()`, which will return a boolean saying if all the expectations are met or not (instead of throwing an exception);
# Logging

@@ -159,0 +164,0 @@

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