Some more test fixes

- Fix error.js test.
- Make sure test_runner exits with the correct error code.
- Comment tests not implemented in core-properties.
This commit is contained in:
Santiago Gimeno 2014-03-11 17:57:29 +01:00
parent 7d23cbfb9e
commit b6a76b51d7
3 changed files with 22 additions and 18 deletions

View file

@ -102,8 +102,8 @@ x11.createClient(function(err, display) {
function() { function() {
X.terminate(); X.terminate();
X.on('end', function() { X.on('end', function() {
mocha.run(function() { mocha.run(function(failures) {
process.exit(); process.exit(failures);
}); });
}); });

View file

@ -82,8 +82,8 @@ describe('Window property', function() {
}); });
}); });
it('should exist in the ListProperties result after inserted'); // it('should exist in the ListProperties result after inserted');
it('should not exist after GetProperty with delete flag called'); // it('should not exist after GetProperty with delete flag called');
//it('should not exist after GetProperty with delete flag called', function(done) { //it('should not exist after GetProperty with delete flag called', function(done) {
// done(); // done();
//}); //});

View file

@ -5,26 +5,30 @@ var assert = require('assert');
describe('Client', function() { describe('Client', function() {
var display; var display;
beforeEach(function(done) { before(function(done) {
var client = x11.createClient({ debug: true }, function(err, dpy) { var client = x11.createClient({ debug: false }, function(err, dpy) {
console.log(err) should.not.exist(err);
display = dpy; display = dpy;
done(err); done();
}); });
}); });
it('should emit error which is instance of Error with sequence number corresponding to source request', function(done) { it('should emit error which is instance of Error with sequence number corresponding to source request', function(done) {
var times = 0;
display.client.CreateWindow(); // should emit error display.client.CreateWindow(); // should emit error
var seq = display.client.seq_num; var seq = display.client.seq_num;
display.client.once('error', function(err) { display.client.on('error', function(err) {
assert.equal(err.constructor, Error); switch (++ times) {
assert.equal(seq, err.seq); case 11:
display.client.CreateWindow(); // should emit error display.client.removeAllListeners('error');
seq = display.client.seq_num; done(1);
display.client.once('error', function(err) { break;
default:
assert.equal(err.constructor, Error);
assert.equal(seq, err.seq); assert.equal(seq, err.seq);
done(); display.client.CreateWindow(); // should emit error
}); seq = display.client.seq_num;
}); }
}); });
}); });
});