24 lines
519 B
Go
24 lines
519 B
Go
package port
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
)
|
|
|
|
func TestStubDownlinkPublish(t *testing.T) {
|
|
d := &StubDownlink{}
|
|
if err := d.PublishDown(context.Background(), "a", "c1", []byte(`{}`), PublishOpts{QoS: 1}); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if d.Published != 1 {
|
|
t.Fatalf("published=%d", d.Published)
|
|
}
|
|
}
|
|
|
|
func TestStubUplinkHandlerCompile(t *testing.T) {
|
|
var h UplinkHandler = StubUplinkHandler{}
|
|
if err := h.OnSessionEstablished(context.Background(), ConnInfo{EndpointID: "a"}); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|