Fixing some code and finally have Travis building
Signed-off-by: Cale Hoopes <caledh@gmail.com>
This commit is contained in:
parent
dcb6354b49
commit
7cdd995d1c
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue