Skip to content

Commit

Permalink
Add test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Moneta committed May 5, 2016
1 parent 5e74003 commit b453949
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions test/server_tests.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var dgram = require('dgram'),
net = require('net');
net = require('net'),
fs = require('fs');

var config = {
address: '127.0.0.1',
Expand Down Expand Up @@ -59,5 +60,24 @@ module.exports = {
});
client.end();
});
},
unix_socket_data_received: function(test) {
test.expect(3);
var server = require('../servers/tcp');
config.socket = './statsd_tmp.socket';
var started = server.start(config, function (data, rinfo) {
test.equal(msg, data.toString());
test.equal(msg.length, rinfo.size);
fs.unlinkSync(config.socket);
config.socket = undefined;
test.done();
});

test.ok(started);

var client = net.connect(config.socket, function () {
client.write(msg);
client.end();
});
}
}
};

0 comments on commit b453949

Please sign in to comment.