cylon/spec/lib/adaptor.spec.js

47 lines
1.1 KiB
JavaScript
Raw Permalink Normal View History

2014-12-15 07:21:28 +08:00
"use strict";
2013-12-19 04:26:21 +08:00
var Adaptor = source("adaptor"),
Utils = source("utils");
2014-03-22 01:15:53 +08:00
describe("Adaptor", function() {
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");
});
});
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();
});
});
});
});