Fixing some code and finally have Travis building

Signed-off-by: Cale Hoopes <caledh@gmail.com>
This commit is contained in:
Cale Hoopes 2016-07-17 15:53:12 -07:00
parent dcb6354b49
commit 7cdd995d1c
2 changed files with 6 additions and 6 deletions

View File

@ -88,12 +88,7 @@ func (a *NatsAdaptor) On(event string, f func(s []byte)) bool {
return false
}
a.client.Subscribe(event, func(msg *nats.Msg) {
incoming := msg.Data
if string(incoming) == "PING" {
a.Publish(event, []byte("PONG"))
} else {
f(msg.Data)
}
f(msg.Data)
})
return true
}

View File

@ -10,6 +10,11 @@ import (
var _ gobot.Adaptor = (*NatsAdaptor)(nil)
func TestNatsAdaptorReturnsName(t *testing.T) {
a := NewNatsAdaptor("Nats", "localhost:4222", 9999)
gobottest.Assert(t, a.Name(), "Nats")
}
func TestNatsAdaptorPublishWhenConnected(t *testing.T) {
a := NewNatsAdaptor("Nats", "localhost:4222", 9999)
a.Connect()