mirror of
https://github.com/siemens-mobile-hacks/node-serialport-bindings-cpp.git
synced 2026-11-26 02:47:17 +00:00
Merge pull request #233 from JayBeavers/fix226
Added SerialPortFactory with on('error')
This commit is contained in:
commit
e86b9679da
3 changed files with 502 additions and 479 deletions
|
|
@ -2,3 +2,7 @@ language: node_js
|
|||
node_js:
|
||||
- "0.10"
|
||||
compiler: clang
|
||||
|
||||
"scripts": {
|
||||
"test": "mocha -R spec"
|
||||
}
|
||||
944
serialport.js
944
serialport.js
File diff suppressed because it is too large
Load diff
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue