Add default interval in Driver class
This commit is contained in:
parent
7560507f11
commit
e72ce5ceac
|
@ -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 = {};
|
||||
};
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue