mirror of
https://github.com/wassname/HackFlowy.git
synced 2026-09-12 12:03:26 +08:00
Initial work on the server
This commit is contained in:
+32
@@ -0,0 +1,32 @@
|
||||
var common = require('../../common');
|
||||
var connection = common.createConnection({socketPath: common.fakeServerSocket});
|
||||
var assert = require('assert');
|
||||
|
||||
var server = common.createFakeServer();
|
||||
var didConnect = false;
|
||||
server.listen(common.fakeServerSocket, function(err) {
|
||||
if (err) throw err;
|
||||
|
||||
connection.connect(function(err) {
|
||||
if (err) throw err;
|
||||
|
||||
assert.equal(didConnect, false);
|
||||
didConnect = true;
|
||||
|
||||
connection.destroy();
|
||||
server.destroy();
|
||||
});
|
||||
});
|
||||
|
||||
var hadConnection = false;
|
||||
server.on('connection', function(connection) {
|
||||
connection.handshake();
|
||||
|
||||
assert.equal(hadConnection, false);
|
||||
hadConnection = true;
|
||||
});
|
||||
|
||||
process.on('exit', function() {
|
||||
assert.equal(didConnect, true);
|
||||
assert.equal(hadConnection, true);
|
||||
});
|
||||
Reference in New Issue
Block a user