Add default interval in Driver class

This commit is contained in:
Andrew Stewart 2014-09-16 14:42:45 -07:00
parent 7560507f11
commit e72ce5ceac
2 changed files with 7 additions and 0 deletions

View File

@ -25,6 +25,7 @@ var Driver = module.exports = function Driver(opts) {
this.name = opts.name;
this.device = opts.device;
this.connection = this.device.connection;
this.interval = opts.interval || 10;
this.commands = {};
};

View File

@ -37,6 +37,12 @@ describe("Driver", function() {
it("sets @commands to an empty object by default", function() {
expect(driver.commands).to.be.eql({});
});
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 });
expect(driver.interval).to.be.eql(2000);
});
});
describe("#setupCommands", function() {