Add specs for new #connections/#devices behaviour

This commit is contained in:
Andrew Stewart 2014-12-15 13:17:04 -08:00
parent 766e35878d
commit 36d1505c2f
1 changed files with 22 additions and 0 deletions

View File

@ -292,6 +292,17 @@ describe("Robot", function() {
}); });
}); });
context("when passed an object containing connection details", function() {
it("creates new connections with each of the ones provided", function() {
var connections = {
loopback: { adaptor: "loopback" }
};
bot.initConnections({ connections: connections });
expect(bot.connections.loopback).to.be.instanceOf(Adaptor);
});
});
context("when passed an array of connection objects", function() { context("when passed an array of connection objects", function() {
it("creates new connections with each of the ones provided", function() { it("creates new connections with each of the ones provided", function() {
var connections = [{ name: "loopback", adaptor: "loopback" }]; var connections = [{ name: "loopback", adaptor: "loopback" }];
@ -367,6 +378,17 @@ describe("Robot", function() {
}); });
}); });
context("when passed an object containing device details", function() {
it("creates new devices with each of the ones provided", function() {
var devices = {
ping: { driver: "ping" }
};
bot.initDevices({ devices: devices });
expect(bot.devices.ping).to.be.instanceOf(Driver);
});
});
context("when passed an array of device objects", function() { context("when passed an array of device objects", function() {
it("instantiates new drivers with provided objects", function() { it("instantiates new drivers with provided objects", function() {
var devices = [{ name: "ping", driver: "ping" }]; var devices = [{ name: "ping", driver: "ping" }];