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

dummy

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dummy - npm Package Compare versions

Comparing version 0.1.3 to 0.1.5

13

lib/dummy.js

@@ -64,5 +64,12 @@ var net = require('net');

sendObj : function(_object, _responseObject, _callback) {
var _data = JSON.stringify(_object);
var _response = JSON.stringify(_responseObject);
this.send(_data, _response, _callback);
var data = JSON.stringify(_object);
var response = JSON.stringify(_responseObject);
this.send(data, response, _callback);
},
wait : function(_response, _callback) {
Dummy.currentPair = {data: null, response: _response, callback: _callback};
},
waitObj : function(_responseObject, _callback) {
var response = JSON.stringify(_responseObject);
this.wait(response, _callback);
}

@@ -69,0 +76,0 @@ }

@@ -5,3 +5,3 @@ {

"description": "a tcp/tls dummy client for server testing",
"version": "0.1.3",
"version": "0.1.5",
"homepage": "http://www.github.com/mattegan/Dummy.js",

@@ -8,0 +8,0 @@ "repository": {

@@ -64,3 +64,3 @@ var net = require('net');

});
describe('#send()', function(_done) {
describe('#send()', function() {
//the following two tests are mostly self explanatory

@@ -87,3 +87,3 @@ it('should get a callback when the data responded was equal to what was respected', function(_done) {

});
describe('#sendObj()', function(_done) {
describe('#sendObj()', function() {
//the following two tests are mostly self explanatory

@@ -99,2 +99,54 @@ it('should send objects and recieve them', function(_done) {

});
describe('#wait()', function() {
var responseServer;
before(function(_done) {
responseServer = net.createServer(function(_socket) {
setTimeout(function() {
_socket.write('you connected\n')
_socket.end();
}, 5);
});
responseServer.listen(serverPort + 1, function(){
_done();
});
});
after(function(_done) {
responseServer.close();
_done();
});
it('should wait for a specific response (without sending) and call a callback', function(_done) {
var dummy = new Dummy(false, serverPort + 1, '127.0.0.1', '\n', function() {
dummy.wait('you connected', function(expected, data) {
expected.should.be.true;
_done();
});
});
});
});
describe('#waitObj()', function() {
var responseServer;
before(function(_done) {
responseServer = net.createServer(function(_socket) {
setTimeout(function() {
_socket.write('{"data":"a response"}\n')
_socket.end();
}, 5);
});
responseServer.listen(serverPort + 1, function(){
_done();
});
});
after(function(_done) {
responseServer.close();
_done();
});
it('should wait for a specific response (without sending) and call a callback', function(_done) {
var dummy = new Dummy(false, serverPort + 1, '127.0.0.1', '\n', function() {
dummy.waitObj({data: 'a response'}, function(expected, data) {
expected.should.be.true;
_done();
});
});
});
});
});
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