diff --git a/lib/x11/xcore.js b/lib/x11/xcore.js index de7b067..654280e 100644 --- a/lib/x11/xcore.js +++ b/lib/x11/xcore.js @@ -31,7 +31,7 @@ function XClient(stream, displayNum, screenNum) this.screenNum = screenNum; this.authHost = os.hostname(); - pack_stream = new PackStream(); + var pack_stream = new PackStream(); // data received from stream is dispached to // read requests set by calls to .unpack and .unpackTo @@ -381,6 +381,7 @@ module.exports.createClient = function(initCb, display, options) } else if(host == '127.0.0.1') //TODO check if it's consistent with xlib (DISPLAY=127.0.0.1:0 -> local unix socket or port 6000?) socketPath = '/tmp/.X11-unix/X' + displayNum; } + //socketPath = '/tmp/.X11-unix/X' + displayNum; if(socketPath) { stream = net.createConnection(socketPath); diff --git a/package.json b/package.json index b9e5943..f74c639 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "sinon": "*" } , "scripts": { - "test": "mocha", + "test": "mocha --globals 'r,i'", "prepublish" : "npm prune" } } diff --git a/test/connect.js b/test/connect.js new file mode 100644 index 0000000..48c75e2 --- /dev/null +++ b/test/connect.js @@ -0,0 +1,19 @@ +var x11 = require('../lib/x11'); +//var sinon = require('sinon'); +var should = require('should'); + +describe("Client", function() { + + beforeEach(function() { + }); + + afterEach(function() { + }); + + it("calls first createClient parameter with display object", function(done) { + var client = x11.createClient(function(display) { + should.exist(display); + done(); + }); + }); +});