var Cylon = require('cylon'); Cylon.robot({ connection: { name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' }, device: { name: 'led', driver: 'led', pin: 13}, work: function(my) { every((1).second(), my.led.toggle); } }).start();
describe("robot", function () { var robot = Cylon.findRobot("testor"); it("should have work", function () { return robot.work.should.be.a('function'); }); it("should toggle the led after 1 second", function (done) { var led = robot.devices['led']; var toggle = sinon.stub(led, 'toggle'); clock.tick((1).second()); toggle.should.have.been.called; done(); }); });