Remove Adaptor#_noop function
This commit is contained in:
parent
333dc881ea
commit
1b549f2dbb
|
@ -29,13 +29,3 @@ var Adaptor = module.exports = function Adaptor(opts) {
|
||||||
Utils.subclass(Adaptor, Basestar);
|
Utils.subclass(Adaptor, Basestar);
|
||||||
|
|
||||||
Adaptor.prototype.commands = [];
|
Adaptor.prototype.commands = [];
|
||||||
|
|
||||||
// Public: Voids all command functions so they do not interact
|
|
||||||
// with anything after disconnect has been called.
|
|
||||||
//
|
|
||||||
// Returns nothing
|
|
||||||
Adaptor.prototype._noop = function() {
|
|
||||||
this.commands.forEach(function(command) {
|
|
||||||
this[command] = function() {};
|
|
||||||
}.bind(this));
|
|
||||||
};
|
|
||||||
|
|
|
@ -23,22 +23,4 @@ describe("Adaptor", function() {
|
||||||
expect(adaptor.commands).to.be.eql([]);
|
expect(adaptor.commands).to.be.eql([]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("#_noop", function() {
|
|
||||||
var hello;
|
|
||||||
|
|
||||||
beforeEach(function() {
|
|
||||||
adaptor.commands = ["hello"];
|
|
||||||
hello = adaptor.hello = spy();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("sets all adaptor commands to no-op functions", function() {
|
|
||||||
expect(adaptor.hello).to.be.eql(hello);
|
|
||||||
|
|
||||||
adaptor._noop();
|
|
||||||
|
|
||||||
adaptor.hello();
|
|
||||||
expect(hello).to.not.be.called;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue