WIP on init/start connections and devices
This commit is contained in:
parent
17be53408a
commit
d7cc0c3730
|
@ -11,7 +11,23 @@
|
||||||
module.exports = class Robot
|
module.exports = class Robot
|
||||||
constructor: (opts) ->
|
constructor: (opts) ->
|
||||||
@name = opts.name
|
@name = opts.name
|
||||||
|
@connections = initConnections(opts.connection or opts.connections)
|
||||||
|
@devices = initDevices(opts.device or opts.devices)
|
||||||
@work = opts.work or -> (console.log "No work yet")
|
@work = opts.work or -> (console.log "No work yet")
|
||||||
|
|
||||||
|
initConnections = (connections) ->
|
||||||
|
console.log "Initialing connections..."
|
||||||
|
|
||||||
|
initDevices = (devices) ->
|
||||||
|
console.log "Initialing devices..."
|
||||||
|
|
||||||
start: ->
|
start: ->
|
||||||
|
startConnections()
|
||||||
|
startDevices()
|
||||||
(@work)
|
(@work)
|
||||||
|
|
||||||
|
startConnections = ->
|
||||||
|
console.log "Starting connections..."
|
||||||
|
|
||||||
|
startDevices = ->
|
||||||
|
console.log "Starting devices..."
|
||||||
|
|
|
@ -29,8 +29,7 @@ describe "basic tests", ->
|
||||||
# hard equal
|
# hard equal
|
||||||
data[0].should.be.equal obj
|
data[0].should.be.equal obj
|
||||||
|
|
||||||
# Now on to a `real` test
|
|
||||||
it "cylon should create a robot", ->
|
it "cylon should create a robot", ->
|
||||||
cylon.should.have.keys 'robot'
|
cylon.should.have.keys 'robot'
|
||||||
robot = cylon.robot(name: 'caprica')
|
robot = cylon.robot(name: 'caprica six')
|
||||||
robot.name.should.be.eql 'caprica'
|
robot.name.should.be.eql 'caprica six'
|
||||||
|
|
Loading…
Reference in New Issue