don't set options on a callback open function

This commit is contained in:
Francis Gulotta 2013-12-14 19:54:32 -05:00
parent 88bc4c47ce
commit c796fe7dce
2 changed files with 9 additions and 1 deletions

View file

@ -77,7 +77,8 @@ function SerialPortFactory() {
callback = null;
}
options = options || {};
options = (typeof options !== 'function') && options || {};
openImmediately = (openImmediately === undefined || openImmediately === null) ? true : openImmediately;
stream.Stream.call(this);

View file

@ -50,6 +50,13 @@ describe('SerialPort', function () {
var port = new SerialPort('/dev/exists', { databits : 19 }, false, errorCallback);
});
it('allows optional options', function (done) {
var cb = function () {};
var port = new SerialPort('/dev/exists', cb);
expect(typeof port.options).to.eq('object');
done();
});
});
describe('reading data', function () {