actually initialize the serialport without mocks in tests

This commit is contained in:
Francis Gulotta 2014-01-23 20:13:15 -05:00
parent 6c9a7b4704
commit c3c2e4fe34

28
test/serialport-c.js Normal file
View file

@ -0,0 +1,28 @@
"use strict";
var sinon = require("sinon");
var chai = require('chai');
var expect = chai.expect;
describe('SerialPort', function () {
var sandbox;
beforeEach(function () {
sandbox = sinon.sandbox.create();
});
afterEach(function () {
sandbox.restore();
});
describe('Initialization', function () {
it("Throws an error in callback when trying to open an invalid port", function (done) {
var SerialPort = require('../').SerialPort;
var port = new SerialPort('/dev/nullbad', function (err) {
chai.assert.isDefined(err, "didn't get an error");
done();
});
});
});
});