2014-12-15 07:21:28 +08:00
|
|
|
"use strict";
|
2013-12-19 04:26:21 +08:00
|
|
|
|
2015-06-09 22:21:03 +08:00
|
|
|
var Adaptor = lib("adaptor"),
|
|
|
|
Utils = lib("utils");
|
2014-03-22 01:15:53 +08:00
|
|
|
|
2014-02-28 04:10:00 +08:00
|
|
|
describe("Adaptor", function() {
|
2015-03-20 01:42:51 +08:00
|
|
|
var adaptor;
|
|
|
|
|
|
|
|
beforeEach(function() {
|
|
|
|
adaptor = new Adaptor({ name: "adaptor" });
|
|
|
|
});
|
2013-12-19 04:26:21 +08:00
|
|
|
|
2014-03-22 01:15:53 +08:00
|
|
|
describe("#constructor", function() {
|
|
|
|
it("sets @name to the provided name", function() {
|
2014-12-15 07:21:28 +08:00
|
|
|
expect(adaptor.name).to.be.eql("adaptor");
|
2014-02-28 04:10:00 +08:00
|
|
|
});
|
|
|
|
});
|
2015-03-20 08:33:31 +08:00
|
|
|
|
|
|
|
describe("#interface methods", function() {
|
|
|
|
var child;
|
|
|
|
|
|
|
|
var Child = function Child() {};
|
|
|
|
|
|
|
|
Utils.subclass(Child, Adaptor);
|
|
|
|
|
|
|
|
beforeEach(function() {
|
|
|
|
child = new Child();
|
|
|
|
});
|
|
|
|
|
|
|
|
describe("#connect", function() {
|
|
|
|
it("throws an error unless overwritten", function() {
|
|
|
|
expect(child.connect).to.throw();
|
|
|
|
child.connect = function() {};
|
|
|
|
expect(child.connect).to.not.throw();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe("#disconnect", function() {
|
|
|
|
it("throws an error unless overwritten", function() {
|
|
|
|
expect(child.disconnect).to.throw();
|
|
|
|
child.disconnect = function() {};
|
|
|
|
expect(child.disconnect).to.not.throw();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2014-02-28 04:10:00 +08:00
|
|
|
});
|