first integration test

This commit is contained in:
Andrey Sidorov 2012-05-31 12:53:45 +10:00
parent b6a0ceff7f
commit 0fd0e4485a
3 changed files with 22 additions and 2 deletions

View file

@ -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);

View file

@ -24,7 +24,7 @@
"sinon": "*"
}
, "scripts": {
"test": "mocha",
"test": "mocha --globals 'r,i'",
"prepublish" : "npm prune"
}
}

19
test/connect.js Normal file
View file

@ -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();
});
});
});