Merge pull request #233 from JayBeavers/fix226

Added SerialPortFactory with on('error')
This commit is contained in:
Jay Beavers 2013-10-25 15:06:08 -07:00
commit e86b9679da
3 changed files with 502 additions and 479 deletions

View file

@ -2,3 +2,7 @@ language: node_js
node_js:
- "0.10"
compiler: clang
"scripts": {
"test": "mocha -R spec"
}

File diff suppressed because it is too large Load diff

View file

@ -82,4 +82,37 @@ describe ('basics', function() {
});
});
});
describe('test error handling', function() {
it('creates a new SerialPort with invalid name, opens it, and looks for error callback', function(done) {
var errorCallback = function(err) {
chai.assert.isDefined(err);
done();
};
var port = new serialPort.SerialPort('johnJacobJingleheimerSchmidt', null, true, errorCallback);
});
it('creates a new SerialPort with invalid name, opens it, and looks for error event', function(done) {
serialPort.on('error', function(err) {
chai.assert.isDefined(err);
done();
});
var port = new serialPort.SerialPort('johnJacobJingleheimerSchmidt', null, true);
});
it('creates a new SerialPort with invalid databits and looks for error callback', function(done) {
var errorCallback = function(err) {
chai.assert.isDefined(err);
done();
};
var port = new serialPort.SerialPort('johnJacobJingleheimerSchmidt', { databits : 19 }, false, errorCallback);
});
});
});