It("publishes sensor name to sensor list", func() { service.NewTouchSensor("4") go gbot.Start() broker.IsConnectedOutput.ret0 <- true Eventually(broker.PublishCalled).Should(Receive(BeTrue())) Eventually(broker.PublishInput.arg0).Should(Receive(Equal(sensors.SENSORS_LIST_KEY))) Eventually(broker.PublishInput.arg1).Should(Receive(MatchJSON(`{"sensors":["/wff/v1/sp1/touchsensor4"]}`))) }) Context("Touch", func() { It("adds touch robot to gobot", func() { service.NewTouchSensor("2") Eventually(gbot.Robots().Len()).Should(Equal(1)) Expect(gbot.Robot("touchsensor2")).ToNot(BeNil()) }) It("publishes alert on touch push event", func() { service.NewTouchSensor("3") evt := event.Event{ Name: "touchsensor3", Data: "touched", } eventTouched, _ := json.Marshal(evt) evt = event.Event{ Name: "touchsensor3", Data: "released", } eventReleased, _ := json.Marshal(evt)