cylon/test/dist/specs/device.spec.js

37 lines
929 B
JavaScript
Raw Normal View History

2013-10-25 05:25:42 +08:00
(function() {
'use strict';
2013-11-05 04:16:42 +08:00
source("device");
2013-10-25 05:25:42 +08:00
2013-11-05 04:16:42 +08:00
source("robot");
2013-10-25 05:25:42 +08:00
2013-11-12 00:28:37 +08:00
source("test/driver");
2013-10-25 05:25:42 +08:00
describe("Device", function() {
var device, driver, requireDriver, robot;
2013-11-05 04:16:42 +08:00
robot = new Cylon.Robot({
2013-10-25 05:25:42 +08:00
name: 'me'
});
2013-11-12 00:28:37 +08:00
driver = new Cylon.Driver({
2013-10-25 05:25:42 +08:00
name: 'driving'
});
requireDriver = sinon.stub(robot, 'requireDriver').returns(driver);
2013-11-05 04:16:42 +08:00
device = new Cylon.Device({
2013-10-25 05:25:42 +08:00
name: "devisive",
driver: 'driving',
robot: robot
});
it("should belong to a robot", function() {
return device.robot.name.should.be.equal('me');
});
it("should have a name", function() {
return device.name.should.be.equal('devisive');
});
it("should use default connection if none specified");
it("should use connection if one is specified");
2013-10-29 02:58:31 +08:00
return it("should require a driver", function() {
2013-10-25 05:25:42 +08:00
return requireDriver.should.be.called;
});
});
}).call(this);