feat: 补齐模块接口契约与管理 API 文档
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user