Skip to content

Commit

Permalink
deps: @esatterwhite/micromock
Browse files Browse the repository at this point in the history
replace hammock with micromock
  • Loading branch information
esatterwhite committed Dec 6, 2018
1 parent 2234f45 commit a7d9a25
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 36 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var _ = require('underscore');
var EventEmitter = require('events').EventEmitter;
var farmhash = require('farmhash');
var timers = require('timers');
var hammock = require('hammock');
var micromock = require('@esatterwhite/micromock');
var metrics = require('metrics');
var packageJSON = require('./package.json');

Expand Down Expand Up @@ -663,7 +663,7 @@ RingPop.prototype.handleOrProxyAll =

dests.forEach(function(dest) {
var destKeys = keysByDest[dest];
var res = hammock.Response(function(err, resp) {
var res = micromock.Response(function(err, resp) {
onResponse(err, resp, dest);
});
if (whoami === dest) {
Expand Down
4 changes: 2 additions & 2 deletions lib/request-proxy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
'use strict';

var body = require('body');
var hammock = require('hammock');
var micromock = require('@esatterwhite/micromock');
var numOrDefault = require('../util.js').numOrDefault;
var PassThrough = require('stream').PassThrough;
var safeParse = require('../util.js').safeParse;
Expand Down Expand Up @@ -290,7 +290,7 @@ RequestProxy.prototype.handleRequest = function handleRequest(head, body, cb) {

this._incrementInflightRequests();

var httpResponse = hammock.Response(onResponse);
var httpResponse = new micromock.Response(onResponse);
ringpop.emit('request', httpRequest, httpResponse, head);

function onResponse(err, resp) {
Expand Down
35 changes: 9 additions & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
"view-cover": "opn coverage/index.html"
},
"dependencies": {
"@esatterwhite/micromock": "^1.1.0",
"body": "^5.0.0",
"error": "^5.0.0",
"farmhash": "^2.1.0",
"hammock": "^2.0.1",
"metrics": "^0.1.8",
"node-uuid": "^1.4.3",
"toobusy-js": "^0.5.0",
Expand Down
1 change: 1 addition & 0 deletions test/integration/proxy_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ test('handleOrProxy() proxies for not me', function t(assert) {
var cluster = allocCluster(function onReady() {
var keyTwo = cluster.keys.two;

debugger;
cluster.request({
key: keyTwo,
host: 'one',
Expand Down
6 changes: 3 additions & 3 deletions test/lib/alloc-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@

'use strict';

var hammock = require('hammock');
var micromock = require('@esatterwhite/micromock');

module.exports = allocRequest;

function allocRequest(opts) {
var req = hammock.Request(opts);
var req = new micromock.Request(opts);

if ('json' in opts && opts.json !== true) {
req.headers['content-type'] = 'application/json';
req.setHeader('content-type', 'application/json');
}

if ('json' in opts && opts.json !== true) {
Expand Down
4 changes: 2 additions & 2 deletions test/lib/alloc-response.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@

'use strict';

var hammock = require('hammock');
var micromock = require('@esatterwhite/micromock');
var tryIt = require('tryit');

module.exports = allocResponse;

function allocResponse(opts, cb) {
return hammock.Response(onResponse);
return new micromock.Response(onResponse);

function onResponse(err, resp) {
if (err) {
Expand Down

0 comments on commit a7d9a25

Please sign in to comment.