Files
mesh-sdk/go/buscalls/buscalls_test.go
T
jschoubben 2895a21e69
mesh/delivery merged: source.main moved to novox/mesh-sdk@8fbba810609e
mesh/delivery-group group feature/1979-zfs-owns-zfs merged: every member is merged
mesh/check being carried to 2895a21e69cd on 8fbba810609e | from e42b9491c931, mesh-catalog 117f933dacf0, mesh-delivery 7221a1e5cd7f, mesh-host 0193949…
buscalls: StreamPublish says an event on a module's own bound stream (A-42)
Builds: design 42 zfs-owns-zfs §25, §24, lead answer A-42
2026-11-13 01:47:29 +01:00

22 lines
762 B
Go

package buscalls
import (
"encoding/json"
"testing"
)
// A-42: stream.publish is a method of its own, beside read and fill, and its request and answer keep their field names.
func TestStreamPublishIsAMethodWithItsShapes(t *testing.T) {
if StreamPublish != "mesh/stream.publish" || StreamPublish == StreamRead || StreamPublish == StreamFill {
t.Fatalf("method %q", StreamPublish)
}
b, _ := json.Marshal(StreamPublishRequest{Stream: "events", Event: "scrub.requested", Body: json.RawMessage(`{"a":1}`), ID: "x"})
if string(b) != `{"stream":"events","event":"scrub.requested","body":{"a":1},"id":"x"}` {
t.Errorf("request %s", b)
}
a, _ := json.Marshal(StreamPublished{Sequence: 7})
if string(a) != `{"sequence":7}` {
t.Errorf("answer %s", a)
}
}