Fixup interval in driver

This commit is contained in:
Andrew Stewart 2014-09-18 12:03:37 -07:00
parent ce41885ab4
commit b7467e7a63
2 changed files with 9 additions and 2 deletions

View File

@ -21,11 +21,12 @@ var Basestar = require('./basestar'),
// Returns a new Driver
var Driver = module.exports = function Driver(opts) {
opts = opts || {};
var extraParams = opts.extraParams || {}
this.name = opts.name;
this.device = opts.device;
this.connection = this.device.connection;
this.interval = opts.interval || 10;
this.interval = extraParams.interval || 10;
this.commands = {};
};

View File

@ -40,7 +40,13 @@ describe("Driver", function() {
it("sets @interval to 10ms by default, or the provided value", function() {
expect(driver.interval).to.be.eql(10);
driver = new Driver({ name: 'driver', device: device, interval: 2000 });
driver = new Driver({
name: 'driver',
device: device,
extraParams: {
interval: 2000
}
});
expect(driver.interval).to.be.eql(2000);
});
});