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) } }