WIP: Change noop to use anonymous function and added tests.
This commit is contained in:
parent
ed8d6faeee
commit
1eabab6ec9
|
@ -66,9 +66,7 @@ Adaptor.prototype.disconnect = function(callback) {
|
|||
//
|
||||
// Returns nothing
|
||||
Adaptor.prototype._noop = function() {
|
||||
var fnVoid = (function(command) {
|
||||
this[command] = function() {return null };
|
||||
}).bind(this);
|
||||
|
||||
this.commands.forEach(fnVoid);
|
||||
this.commands.forEach((function(command) {
|
||||
this[command] = function() { return null; };
|
||||
}).bind(this));
|
||||
};
|
||||
|
|
|
@ -72,4 +72,20 @@ describe("Adaptor", function() {
|
|||
expect(callback).to.be.called;
|
||||
})
|
||||
});
|
||||
|
||||
describe("#_noop", function() {
|
||||
before(function() {
|
||||
adaptor.commands = ['write', 'read'];
|
||||
adaptor._noop();
|
||||
adaptor.write = spy();
|
||||
adaptor.read = spy();
|
||||
});
|
||||
|
||||
it("adaptor commands return null", function() {
|
||||
var string = "Disconnecting from adaptor 'adaptor'.";
|
||||
|
||||
expect(adaptor.write).to.have.returned(null);
|
||||
expect(adaptor.read).to.have.returned(null);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue